> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf > Of Milos Puzovic > > > I was trying to run the following simple C code: > > void func(); > > main() { > func(); > } > > void func() { printf("Hello world from func()!"); } > > First, I compiled it with gcc program.c -o program. Then I tried to run > it, but I got "Segmentation fault (core dumped)" message. > > The version of gcc is 3.2 20020927 (prerelease).
[EMAIL PROTECTED] ~/Projects <xc=0> $ cat >z.c void func(); main() { func(); } void func() { printf("Hello world from func()!"); } [EMAIL PROTECTED] ~/Projects <xc=0> $ gcc -o z z.c [EMAIL PROTECTED] ~/Projects <xc=0> $ ./z Hello world from func()[EMAIL PROTECTED] ~/Projects <xc=24> $ gcc --version gcc (GCC) 3.2 20020927 (prerelease) Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [EMAIL PROTECTED] ~/Projects <xc=0> $ uname -a CYGWIN_NT-5.0 P450 1.3.22(0.78/3/2) 2003-03-18 09:20 i686 unknown unknown Cygwin [EMAIL PROTECTED] ~/Projects <xc=0> $ -- i.e. WFM. BTW, use "int main() { ...; return 0;}" - even in test code. As you can see the amount of characters printed in func() gets sent as exit code. Did you expect that? ;-) /Hannu E K Nevalainen, 59~14'N, 17~12'E ~ <=> degree -- --END OF MESSAGE-- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/