Hi All
I've written a test program to experiment with structs a little bit:
When I run this program I get a Bus error. As far as I know it has todo with the second bar->id but I can't figure out why.Code:#include <stdio.h> struct FOO { int id ; } foo, *bar; struct FOO test(struct FOO x) ; // prototype int main(int argc, char *argv[]) { foo.id = 10 ; bar->id = 20 ; printf("%d %d\n", foo.id, bar->id) ; test(foo) ; return 0 ; } struct FOO test(struct FOO s) { return s ; }
Any suggestions ?
cheers