Per esempio se devo fare una cosa del genere mi creo una funzione per l' input:
codice:
char *input (void)
{
char buffer[100];
char *pointer;
fgets(buffer,100,stdin);
pointer=(char*)calloc(strlen(buffer)+1,sizeof(char));
strcpy(pointer,buffer);
return pointer;
}
Presupponendo che legge al massimo 100 caratteri,poi si potrebbe anche allungarla facilmente.
Una volta fatta questa funzione basta sapere che quando hai un array di puntatori ogni puntatore è una stringa.
Ad esempio fai:
codice:
char **pointer;
// vuoi 5 stringhe ?
pointer=(char**)calloc(5,sizeof(char*);
int i;
for(i=0;i<5;i++)
{
pointer=input();
fflush(stdin);
}