How do I read a string into an array without either fixing the length of the string or getting the user to enter the length first?
I thought this kind of thing might do it, but no joy:
char *H;
int i, n;
gets(H);
n = strlen(H);
for(i = 0; i < n; i++)
printf("%c", H[i]);
printf("\n");
I know I could do something like
char H[100];
but I wondered if there was another way?