C examples for Function:Function Return
If there is no assignment specified, the return value is simply discarded.
Consider the following program, which uses the function mul( ):
#include <stdio.h> int mul(int a, int b); int main(void) { int x, y, z;/*from ww w. j a v a 2 s .c om*/ x = 10; y = 20; z = mul(x, y); /* 1 */ printf("%d", mul(x, y)); /* 2 */ mul(x, y); /* 3 */ return 0; } int mul(int a, int b) { return a*b; }