Socket datagram again.
Pond Scum
hue at island.COM
Sat May 18 10:54:20 AEST 1991
In article <11242 at hub.ucsb.edu> hubert at spica.ucsb.edu writes:
>But when I tried the following program(which could be wrong. I am a rooky.)
> I found out that if I don't add exit(0) at the end of the program. The
>a.out will give me segment fault. Whay is that?
Please take these questions to comp.lang.c. This isn't the group for it.
Or better yet, try to find someone locally who can answer your questions.
>struct record
>{
> int from;
> int to[10];
>}
>
>main()
You've just declared main as a function that returns struct record. Put
a semicolon after the curly brace. You're trashing the stack which causes
the seg fault when you return from main. By calling exit you avoid
returning from main with a trashed stack.
-Jonathan hue at island.COM
More information about the Comp.unix.wizards
mailing list