Scanf fails with bus error
- by Mikulas Dite
I'm playing with C and I've run into this error:
#include <stdio.h>
int main ()
{
char* foo;
scanf("%s", foo);
printf("entered %s", foo);
return 0;
}
scanf takes pointer, foo is pointer, yet I get bus error. How can I make it work?