0

what is wrong with this program

int function1 (int n) { cout << n; } function2 (int n, m) { n += m; function (3.4); }

16th Jul 2016, 2:01 AM
Smiley16
Smiley16 - avatar
4 Answers
+ 1
int function1 (int n) { cout << n; } function2 (int n, int m) { n += m; function1 (3); // why here float as for function1 accepts int }
16th Jul 2016, 2:11 AM
B. K.
0
parameter declaration in function should be done individually. function2 (int n, m) is wrong function2 (int n, int m) is right way of declaration.
16th Jul 2016, 2:05 AM
B. K.
0
one more mistake is in function call; it should be comma instead of full stop.
16th Jul 2016, 2:06 AM
B. K.
0
1) the way you declared your parameters is wrong. you MUST state the data type & identifier. 2) you have it returning a float instead of and int (integer) value that's all, as far as I can see
16th Jul 2016, 5:12 AM
Autumn S
Autumn S - avatar