Discussions Q&R
#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 RéponsesLine breaks
1 Vote
3 RéponsesHello
1 Vote
5 Réponseswhat will be output??
#include <iostream>
using namespace std;
int main(int a)
{
cout << a << "\n";
return 0;
}
int main(char *a)
{
cout << a << endl;
return 0;
}
int main(int a, int b)
{
cout << a << " " << b;
return 0;
}
int main()
{
main(3);
main("Subodh");
main(9, 6);
return 0;
}
if output is compilation compilation error then how can we overload "main" function in C++
0 Vote
5 RéponsesWhat is c?
0 Vote
5 RéponsesWhats wrong this code?
0 Vote
2 Réponsescin >> question
0 Vote
3 RéponsesWhy me
-4 Votes
3 RéponsesAujourd'hui en vedette
How to improve code readability
0 Votes
I NEED to make a game
1 Votes
Regarding course
0 Votes
Solved Grouping data
0 Votes
what is python
0 Votes
Android
0 Votes
Best way to learn
0 Votes