![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
int abc()
{ int a=2, b=1, sum, diff; sum = a+b; diff = a-b; } int main() { int sum, diff; abc(); ... ... ... return 0; } ------------------------------- how can i pass the 2 values: sum & diff in abc() into main() when i call it ? Last edited by trapeze; 03-18-2008 at 10:00 PM. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Quote:
Code:
int abc(int *sum, int *diff)
{
int a=2, b=1;
*sum = a+b;
*diff = a-b;
return 0;
}
int main()
{
int sum, diff;
abc(&sum,&diff);
return 0;
}
Last edited by Yogesh Sawant; 03-19-2008 at 02:36 AM. |
|||
| Google The UNIX and Linux Forums |