Skip to main content

Thread: interesting segmentation fault: why?


going through process of learning c, , thought interesting write program looped indefinitely, , recursively, this:

code:
#include <stdlib.h>    void hello() {       printf("hello");       //calls itself.       hello();  }    main() {       //launches hello() intially       hello();  }
now..obviously, loops indefinitely. doesn't. runs 10 seconds, expected (hellohellohellohello) segfaults. why? far can see, has accessed no memory shouldn't.

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

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account