--- In [email protected], "Bill Cunningham" <[EMAIL PROTECTED]> wrote: > > So speaking of fgets would this be more acceptable? > > char *input; > fgets(input,(10)+2),stdin); > > Is that valid C ?
Apart from the extra bracket, the problem is that although you have the char pointer, input, it isn't pointing at valid memory to hold the characters which will be read. If you try running it, the program will probably crash. What you need is something like: char input[10 + 2]; /* creates an array of 12 chars */ fgets(input, sizeof input, stdin); (It's better to use sizeof instead of '10 + 2' in the fgets because if you change the size of the array, you don't have to remember to change the fgets line.) John
