Why does fgets
segfault when I pass a char
pointer as the first argument? For example:
char *p;
fgets(p, 10, stdin); // segmentation fault
What's with the char
pointer p
, when we just declare it as char *p
(as in the above example)?
thanks!