Hi coders,I have a small problem regarding pointers, I am a bit weak in pointers and need to understand why the following is wrong: int main(void) { char *a; gets(a); return 0; } This causes an exception, please explain the error. I am using Turbo C as compiler, suggest a good and latest compiler too!
Before doing gets on any character pointer u must first allocated memory dyanamically...like this:- a=(char*)malloc(10*sizeof(char)); Now u will not get any error... cheers!!