New course! Every coder should learn Generative AI!
Try a free lessonQ&A Discussions
How to develop a game
-2 Votes
4 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
How do I start c#
1 Votes
Why doesn't this work?
1 Votes
Popsicles
0 Votes
Html img
2 Votes
Challenge accepted
2 Votes