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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not using pointers more than one changed value return in function.

Status
Not open for further replies.

mimi17

Programmer
Aug 27, 2003
1
0
0
US
Is it possible by not using pointers more than one values could be returned in main function?

 
You can use a structure to return multiple values

Code:
struct foo {
  int a;
  char b;
};

struct foo func ( ) {
  struct foo result = { 1, '2' };
  return result;
}

int main ( ) {
  struct foo bar = func();
  return 0;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top