A function can return only one object using the return statement.
In this return statement
return div,mul;
there is used an expression with the comma operator. Its value is the value of the right operand. So in fact as the expression div
has no side effect then the return statement is equivalent to
return mul;
From the C Standard (6.5.17 Comma operator)
2 The left operand of a comma operator is evaluated as a void
expression; there is a sequence point between its evaluation and that
of the right operand. Then the right operand is evaluated; the result
has its type and value. And the compiler will issue an error for the
printf call because there are no enough arguments.
Either declare as the return type a structure as for example
struct Result
{
int div;
int mul;
};
struct Result divmul( int v1, int v2 )
{
struct Result result = { v1 / v2, v1 * v2 };
return result;
}
and then in main
int main( void )
{
int val1 = 50, val2 = 10;
struct Result result = divmul( val1, val2 );
printf( "%d %d\n", result.div, result.mul );
}
Or return the result from the function parameters (the so-called output parameters)
void divmul( int *v1, int *v2 )
{
int div = *v1 / *v2;
int mul = *v1 * *v2;
*v1 = div;
*v2 = mul;
}
And in main
int main( void )
{
int val1 = 50, val2 = 10;
divmul( &val1, &val2 );
printf( "%d %d\n", val1, val2 );
}
Pay attention to that according to the C Standard the function main without parameters shall be declared like
int main( void )