Hi,
I'm pretty new to C programming, so bear with me if this has a simple answer.
I have an error that seems very strange to me. The following code when run produces an error and crashes.
Code:
#include <stdio.h>
#include <string.h>
int main ()
{
int i;
char *str;
gets(str);
return 0;
}
The strange thing is that if i get rid of the or if i put the after the there is no error. Also, the can be replaced by an analogous scanf function and the same error results. The same error also results when using a double, float, char etc... instead of an int.
However, when I declare str as for example, there is no error.
Any ideas?
Thanks for your help.