Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function returning many value

Status
Not open for further replies.

satellite03

IS-IT--Management
Dec 26, 2003
248
IN
how can a function return many value???(usuing pointer)....any pseudocode plz??

thanks


satellite
 
A typical way is to supply the function with many pointers in the parameterlist :

int ival1, ival2, ival3;

func(&ival1, &ival2, &ival3);
printf("\nival1 = %d", ival1);
...


void func(int * p1, int * p2, int * p3)
{
*p1 = 100;
*p2 = 200;
*p3 = 300;
}

Also you could simply supply the function with the address of a structure containing all the required members.

/JOlesen
 
Also there is no problem to return a structure, or an array of some thing

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top