Q&A Discussions
How come 66 in int sum2?
0 Votes
2 Answers#include <iostream>
using namespace std;
int sum(int a, int b=42) {
int result = a + b;
return (result);
}
int main() {
int x = 24;
int y = 36;
//calling the function with both parameters
int result = sum(x, y);
cout << result << endl;
//calling the function without b
result = sum(x);
cout << result << endl;
return 0;
}
why is da last function cout 66 and not 48 isn't it suppose to add 24+24?
1 Vote
6 AnswersHot today
Problem with Javascript function
0 Votes
Guys any tips one getting cubes?
1 Votes
For Programming i need Patience
0 Votes
Html
0 Votes
About css...
0 Votes
Why we use return in function ?
0 Votes