Scanf fails with bus error
Posted
by Mikulas Dite
on Stack Overflow
See other posts from Stack Overflow
or by Mikulas Dite
Published on 2010-06-06T17:52:42Z
Indexed on
2010/06/06
18:02 UTC
Read the original article
Hit count: 400
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?
© Stack Overflow or respective owner