C programming

Reply

Join Date: Aug 2006
Posts: 15
Reputation: the.future.zone is an unknown quantity at this point 
Solved Threads: 1
the.future.zone the.future.zone is offline Offline
Newbie Poster

C programming

 
0
  #1
Aug 22nd, 2006
Hi folks.
I'm just learning C language,and I always come across a statement that I have no idea what it means. What does "returning a variable" mean?
Thanks.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,124
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 283
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: C programming

 
0
  #2
Aug 22nd, 2006
When a function is finished, the final statement in the funct can be something like return x;

x is the value returned into the variable.

Example:

val = add(a, b);    // add A and B
...

int add (int x, int y)  // define the add function
{
    int z;

    z = x + y;     // add the values
    return z;      // return the value of the addition
}
val will contain the sum when the function is finished.

When you get to functions you will understand -- I hope
Last edited by WaltP; Aug 22nd, 2006 at 5:31 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the IT Professionals' Lounge Forum


Views: 1477 | Replies: 1
Thread Tools Search this Thread



Tag cloud for IT Professionals' Lounge
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC