You can only pass one value back in C. Either put a, b and c into a structure and pass the structure address or pass values by reference as FvM showed. If you pass references you might as well pass all three references and use the return for sucess/error codes.
you can do this using pointers . this code is to return 3 values from a function :
void test(int *, int *, int *); /* Prototype of function called Test */
void main()
{
int a, b, c ;
test(&a ,&b ,&c) ; /* Calling test function. */
}
void test(int *pa, int *pb, int *pc)
{
*pa = x ; /* where x, y, z is the values the function will return */
*pb = y ;
*pc = z ;
}
have a note : when you call the function test you give it an arguments
this arguments is the addresses the main function gave to to test function to put the values it want to return in .
#include <stdio.h>
void test(int *, int *,int *); /* Prototype of function called Test */
int main()
{
int a, b, c ;
test(&a ,&b ,&c) ; /* Calling test function. */
}
void test(int *pa, int *pb, int *pc)
{
int x=1,y=2,z=3;
*pa = x ; /* where x, y, z is the values the function will return */
*pb = y ;
*pc = z ;
}