0
Pls what are functions and parameters. And what does void do to them if used?. Thank u
pls I need basic coding examples under c++ to understand better.
4 ответов
+ 6
Functions are blocks of code written to perform a certain task. You can pass data into them that they need (called arguments).
Any function has a return type, a name, and a list of arguments. Ex:
int arrSum(int[] inArr, int arrSize)
{
//your code
return sum;
}
You would call it like this:
arrSum(arr, ARRAY_SIZE);
if the return type is void, it doesn't return any value. However, it's a convention to still write return at the end.
+ 2
Just follow the courses, it's explained.
+ 2
to give you a simple explanation a function is what goes between the { } and parameters are tha variables and what you do with them in the function. void is the return type for a function that will return nothing.
+ 2
and also follow Kabe's advice, work through the tutorials slowly and methodically making sure you understand them before moving on.