Comma Operator in C - Comma Operator in C Program

Learn c - c tutorial - Comma Operator in C Program - c examples - c programs
Comma Operator in C Program
- Process the binary operator and its first operand and leaves the result and then, process the second operand and return the value is known as comma operator.
Sample Code
#include <stdio.h>
//global variable
int status=0;
int testFunction(void) {
printf("Body of testFunction...\n");
//complex return statement
return (status=56, -3);
}
int main()
{
int return_value=0;
printf("Main function started...\n");
return_value=testFunction();
printf("Value of status= %d\n",status);
printf("Return value is: %d\n",return_value);
printf("End of main function...\n");
return 0;
}
Output
Main function started...
Body of test Function...
Value of status= 56
Return value is: -3
End of main function...