This code crashes the program
#include <cstdio>
int main()
{
char *name1;
char *name2 = "Mark";
gets(name1);
puts(name1);
return 0;
}
whereas this doesn't
#include <cstdio>
int main()
{
char *name1 = "Mark";
char *name2;
gets(name2);
puts(name2);
return 0;
}
Why ? I am using MinGW with Code::Blocks IDE.