+ 5

Can someone define what the argument is in a function?? I understand what the parameters are...

1st Jul 2017, 5:20 PM
ma_Stice
ma_Stice - avatar
3 ответов
+ 5
someFunction(a, b) a and b are the parameters, when u call the function like someFunction(4, 20), 4 and 20 are the arguments
1st Jul 2017, 5:29 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 4
Thanks!
1st Jul 2017, 5:31 PM
ma_Stice
ma_Stice - avatar
+ 1
An argument of a function is a variable used as input for the function. When you define your function you should indicate what is the data type of the arguments. For example: int sum(int a, int b) the arguments of this function are two integer numbers, a and b. (the output is also an integer) You can call this function in your main program by inserting numbers straight as arguments or you can add other variables (which correspond to appropriate type) as arguments. For example, the lines of code below do the same thing: int var1= 1; int var2= 3; cout << sum(var1,var2); OR cout << sum(1,3);
3rd Jul 2017, 10:13 PM
Leandro Aluisio Scholz
Leandro Aluisio Scholz - avatar