How to initialze the return value of a function before calling it in main()? [closed]

The question is not very clear but I think you are asking for:

int func(int x, int y)
{
     int retval = 0;

     if ( x == 0 && y == 0 )
          retval = 10;

     // ...other stuff...

     return retval;
}

Some languages have an implicit variable for the return value that you can modify but C does not .

There is no such thing as “initialize the return value before calling the function” , the return value is part of the function execution .

Leave a Comment