Explain the output for the c program below when a valu of 1 and 5 are entered #
ID: 3660435 • Letter: E
Question
Explain the output for the c program below when a valu of 1 and 5 are entered # include void one(int * ptr_a, int * ptr_b); void two(int * ptr_a, int b, int * ptr_c); void three(int a, int b, int c); int main() { int x = 0, y = 0, z = 0; printf("%d ,%d %d ", x, y, z); one(&x,&y); printf("%d ,%d %d ", x, y, z); two(&x,y,&z); printf("%d ,%d %d ", x, y, z); three(x, y, z); printf("%d ,%d %d ", x, y, z); two(&z,y,&x); printf("%d ,%d %d ", x, y, z); } void one (int * ptr_a, int * ptr_b) { printf("Enter a number: "); scanf("%d", ptr_a); //Notice: No '&' here printf("Enter another number: "); scanf("%d", ptr_b); //Notice: No '&' here } void two(int * ptr_a, int b, int * ptr_c) { // b = b + 1; *ptr_c = *ptr_c - 1; *ptr_a = b + *ptr_c; } void three(int a, int b, int c) { a = b - c; b = c - a; c = a - b; printf("%d %d %d ", a, b, c); }Explanation / Answer
there are mistakes in scanf implementation....where "&" is missing..... example:"scanf("%d", &ptr_a);"
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.