void xxx(.....,int res[])
{
.....
....
res[0]=thevaluetobereturned
res[1]=anothervaluetobereturned...
}
When we call this function, the argument what ever you pass in place of res will have the values what you want to return
int * xxx(....)
{
int *res=(int *)malloc(...);
...
...
res[0]=thevaluetobereturned
res[1]=anothervaluetobereturned...
return res;
}
Here, you are creating a dynamic array and storing what ever values you want to return. Then, we return the address of that array.
void xxx(...., int *a, int *b)
{
............
...........
*a=thevaluetobereturned
*b=anothervaluetobereturned...
}
main()
{
int p, q;
xxx(...., &p,&q);
}
Here, p, q contains two values that are calculated in function xxx. One can taken any number of addresses.I haveshown only two.
Global variables thing you have mentioned already
Also, about structures you have mentioned.
Like this we can return more than one value from a function