For example consider following code:
int main(int argc,char *argv[])
{
int *p,*q;
p = (int *)malloc(sizeof(int)*10);
q = (int *)malloc(sizeof(int)*1
return in function return execution back to caller and exit from function terminates the program.
in main function return 0 or exit(0) are same but if you write exit(0) in different function then you program will exit from that position.
returning different values like return 1 or return -1 means that program is returning error .
When exit(0) is used to exit from program, destructors for locally scoped non-static objects are not called. But destructors are called if return 0 is used.