0
How I call a function in other function. Not main
3 Antworten
+ 2
One make sure you have the function definition or have the function be above main and call it like this.
Int apples()
{
Return 0;
}
Int main()
{
apples()
}
If a function your calling had parameters maker sure you include then inside the call (where you see just apples())
Otherwise it will crash. Secondly if you have your function returning data make sure you have something like this a = apples();
What ever the return data is will be stored in that variable in this case it's a
+ 1
It works the same whether you're calling the function in main or in another function. Every function you define in your program or include from a library can be called anywhere in the program.
+ 1
You just have to put the "called function" before the "calling function" in your definition file