is it possible to pass a return value from a function as the return value of the main function in c?

Returning from the initial call to main is defined to be “equivalent to calling the exit function with the value returned by the main function as its argument” (C 2018 1). Therefore, to have the same effect as returning from the initial call to main with value x, all you need to do is call exit(x):

#include <stdlib.h> // To declare “exit”.

int checkNumberOfArguments(int argc)
    if (argc != 2)
    return 0;

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top