Code crashing compiler: main() returning a struct instead of an int

Posted by AndrejaKo on Stack Overflow See other posts from Stack Overflow or by AndrejaKo
Published on 2010-06-07T23:06:49Z Indexed on 2010/06/07 23:22 UTC
Read the original article Hit count: 217

Hi! I'm experimenting with a piece of C code. Can anyone tell me why is VC 9.0 with SP1 crashing for me? Oh, and the code is meant to be an example used in a discussion why something like

 void main (void)

is evil.

struct foo { int i; double d; } main (double argc, struct foo argv)
{

    struct foo a;
    a.d=0;
    a.i=0;
    return a.i;
}

If I put

return a;

compiler doesn't crash.

© Stack Overflow or respective owner

Related posts about c

    Related posts about visual-studio-2008