I\'ve just compiled this C program using Cygwin\'s gcc:
#include
void main (){
char *str;
gets(str);
printf(\"%s\",str);
}
>
The variable str has an undefined value. It means that it simply gets a place on the stack and the value which was there happens to be inside this variable. A possible explication of your behaviour is that a builtin function initializing process environment and invoking your main used this place for a meaningful pointer to some accessible memory. The value of this pointer stayed on the stack and when your main was invoked it happened that str got this value. But this is just one of possible explications.