Hi this is Harrison. How exactly do you get your own function (that uses parameters) that you created to work? I have tried multiple times within many projects, but I haven't seemed to get it to work. In your reply, if you can, may you add an example program? With that, I will be able to better learn about this topic.
Thank you!
Also, the type that I am talking about is like this:
void potato(int amount, int toppings, int cookingtime) { ... }
Here's an example:
-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS
And, keep in mind that you cannot change the value of the functions outside of the function declaration. To change the function outside of the function declaration from inside the body such as main, you would require the address of the variable and insert it via pointers to change it. Functions that return things use int instead of void. I would not suggest void potato(int amount, int toppings, int cookingtime) {
...
{
Instead, I would put: int potato(int amount, int toppings, int cookingtime) {
...
}
And, if the function returns things, use a return statement. Most likely, your program didn't work because you tried to return things with void. So, use int next time.
I know why you always use void for the functions. It is such a bad idea. :) The workshop slides never showed how to use int functions. So disappointed in how they teach.