Exactly..
That's what I was trying to point out
Very original question was 
 
>how to view what does main returns (ie 0 success flag)
>   #include<stdio.h>
>   void main()
>   {
>      printf("godisgreat");
>   }

Here first you have to define success by putting return value (int main() is 
implicit)
 
 int main()
 {
    static int i = 5;
    i--;
    printf("godisgreat");
    if(i) printf("\n main returning %d", main());
    return 0;
 }

Try running above code.
 
Regards,
Bala

--- On Wed, 7/23/08, John Matthews <[EMAIL PROTECTED]> wrote:

From: John Matthews <[EMAIL PROTECTED]>
Subject: [c-prog] Re: main()
To: [email protected]
Date: Wednesday, July 23, 2008, 12:43 PM

--- In [email protected], Bala <[EMAIL PROTECTED]> wrote:
>
> int main()
>  
> {
>    static int i = 5;
>  i--;
>     printf("godisgreat");
>  if(i) printf("\n main returning %d", main());
> }

But there's no return statement, so I get:

godisgreatgodisgreatgodisgreatgodisgreatgodisgreat
 main returning 0
 main returning 18
 main returning 19
 main returning 19

That's using gcc and no optimisation. With optimisation -O1:

godisgreatgodisgreatgodisgreatgodisgreatgodisgreat
 main returning 10
 main returning 19
 main returning 19
 main returning 19

You will probably get something different if you run it.

John


------------------------------------

To unsubscribe, send a blank message to
<mailto:[EMAIL PROTECTED]>.Yahoo! Groups Links




      

[Non-text portions of this message have been removed]

Reply via email to