Thread: interesting segmentation fault: why?
going through process of learning c, , thought interesting write program looped indefinitely, , recursively, this:
now..obviously, loops indefinitely. doesn't. runs 10 seconds, expected (hellohellohellohello) segfaults. why? far can see, has accessed no memory shouldn't.code:#include <stdlib.h> void hello() { printf("hello"); //calls itself. hello(); } main() { //launches hello() intially hello(); }
more of 'i can use, don't understand' question problem such.
happen in other compiled language?
1) real reason of segfault stack overflow.
2) printf buffered, , flushed after line breaks (or huge amount of characters).
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] interesting segmentation fault: why?
Ubuntu
Comments
Post a Comment