Skip to main content
GameDev.net gamedev.net
🔒 Locked

Returns

Started by Drakon Nov 22, 2001 at 12:37 PM 6 replies 350+ views
Original Post
Drakon
Drakon
What do returns do?
"Go for the eyes, Boo, go for the eyes!"
nickm
nickm
They return control to the calling function.
Drakon
Drakon
Could someone give me an example?
(sample code )
"Go for the eyes, Boo, go for the eyes!"
utwo007
utwo007
Here''s an example:

  
int main()
{

int x = decideX();

}

int decideX()
{

return 3;

}


Main calls on decideX, which returns 3. 3, being the result of decideX, is assigned to the int variable x. Control is returned to main().
---signature---People get ready.I'm ready to play.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.