FredTheFred Posted August 18, 2015 Share Posted August 18, 2015 (edited) Hello all, I continue to learn but i've got, again, some questions about functions If i understand a function can be called in a program by name_of_function(); and used return(); to go where this function had been called, right ? now in my example i wrote a function called randomize, She's just randomize a number between 1 to 4 and calling anothers functions to display something on screen by the result of randomize. in the end a return command must return to randomize function. But it's doesn'nt work. Can you tell me why ? Thanks all. Maybe it's not clear for you, if you want i can post the code... Edited August 18, 2015 by FredTheFred Quote Link to comment Share on other sites More sharing options...
Pixelboy Posted August 18, 2015 Share Posted August 18, 2015 Hello all, I continue to learn but i've got, again, some questions about functions If i understand a function can be called in a program by name_of_function(); and used return(); to go where this function had been called, right ? now in my example i wrote a function called randomize, She's just randomize a number between 1 to 4 and calling anothers functions to display something on screen by the result of randomize. in the end a return command must return to randomize function. But it's doesn'nt work. Can you tell me why ? Thanks all. Maybe it's not clear for you, if you want i can post the code... It seems you're really new at this so we need to establish some ground rules for posting in this sub-forum: 1) When you want to ask a question, you MUST include your actual source code, not a code snippet taken from an example you found somewhere on the internet. Don't wait for people to ask you to post your code, do it in the very first post of the thread. 2) When posting parts of your source code, use the "code" tags, to get this result: if (you like the Coleco) { Clap your hands } 3) When you describe your problem or question, you should always refer to the code you posted. If you feel the need to talk about another piece of code which you didn't post, then you should include that piece of code as well. Otherwise you will leave everyone in the dark, especially considering English is not your first language. Following the above guidelines will help the rest of us just as much as it will help you. Quote Link to comment Share on other sites More sharing options...
Kiwi Posted August 18, 2015 Share Posted August 18, 2015 I'm thinking for C++ programming, if I remembered correctly, need return to exit the function.The function in C returns back at the "}". void CreateSomething(void){ coding here; } void main(void){ coding here; CreateSomething(); some more coding; } Quote Link to comment Share on other sites More sharing options...
FredTheFred Posted August 19, 2015 Author Share Posted August 19, 2015 Oh, i'm sorry Pixelboy . I'll do it for the next time. Quote Link to comment Share on other sites More sharing options...
FredTheFred Posted August 19, 2015 Author Share Posted August 19, 2015 Ok guys, i've just forgot to use prototype function. Thanks for your answer Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.