Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can somebody explain to me how this works/help me trace the output please? #include using namespace std; int s=1, y=3; void confuse1(int &y, int s)
Can somebody explain to me how this works/help me trace the output please?
#include using namespace std;
int s=1, y=3;
void confuse1(int &y, int s) {
s++;
y++;
}
void confuse2(int b, int *s) {
y = ++(*s);
*s = b;
} void confuse3(int &a, int *s) {
a = *s + 1; (*s)++;
}
int main() {
int s=2;
confuse1( s, y);
confuse2( s, &y);
confuse3( s, &y);
printf("s + y = %d ", s+y);
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started