I have the following piece of code:
char *str;
gets(str);
Now it works in turbo c but fails to in devc.
I have to add the following in order to make it work in devC++.
char *str = malloc(5);
Can anyone explain, why is it so?
Also, which one is authentic and a more correct form of coding.