#include <stdio.h>

typedef struct
{
  char lettre;
  char *distant;
} undistant;


int main()
{
  undistant* tab = malloc(sizeof(undistant));
  short nb=0;

  char* distant1 = "apps/maps/googlemaps/photos-geolocalisees/index.php";
  char* distant2 = "apps/maps/googlemaps/index.php";

  //undistant x;
  //x.lettre = 'D';
  //x.distant = malloc(strlen(distant1)+1);
  //strcpy(x.distant, distant);
  //printf("%d %c [%s]\n", nb, x.lettre, x.distant);
  //free(x.distant);

  tab = realloc(tab, sizeof(undistant) * (nb+1));
  tab[nb].lettre = 'D';
  tab[nb].distant = malloc(strlen(distant1)+1);
  strcpy(tab[nb].distant, distant1);
  nb++;

  tab = realloc(tab, sizeof(undistant) * (nb+1));
  tab[nb].lettre = 'F';
  tab[nb].distant = malloc(strlen(distant2)+1);
  strcpy(tab[nb].distant, distant2);
  nb++;

  for (int n=0; n<nb; n++) {
    printf("%c [%s]\n", tab[n].lettre, tab[n].distant);
  }

  // libère la mémoire
  for (int n=0; n<nb; n++) {
    free(tab[n].distant);
  }
  free(tab);

  return 0;
}