Show the output of the following program: #include int x = 1; int y = 0; void my
ID: 3694917 • Letter: S
Question
Show the output of the following program: #include int x = 1; int y = 0; void my_first_function(); void my_second_function(); int main() { int x = 10; print f ("The value of x + y in main () is %d ", x + y); my_second_funct ion(); x - -; my_first function(); print f ("The values of x, y in main() are %d %d ", x, y); return 0; } void my_first_function() { x++; y++; printf("The value of x-y in my_first_function() is %d ", x-y); } void_my_second_function() { int x=0, y=2; printf("The value of x-y in my_second_function() is %d ", x-y); }Explanation / Answer
#include <stdio.h>
int x=1;
int y= 0;
void my_first_function();
void my_second_function();
int main()
{
int x= 10;
printf("The value of x+y in main() is %d ", x+y);
my_second_function();
x--;
my_first_function();
printf("The values of x,y in main() is %d %d ", x,y);
return 0;
}
void my_first_function()
{
x++;
y++;
printf("The values of x - y in my_first_function() is %d ", x-y);
}
void my_second_function()
{
int x=0, y=2;
printf("The values of x - y in my_second_function() is %d ", x-y);
}
sample output
The value of x+y in main() is 10
The values of x - y in my_second_function() is -2
The values of x - y in my_first_function() is 1
The values of x,y in main() is 9 1
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.