Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please explain how to get the given output of this C program, thanks! What is th

ID: 3572596 • Letter: P

Question

Please explain how to get the given output of this C program, thanks!

What is the output of the following syntactically correct C program? #include #include #include void yet_another_function (int* p, int* q, int** R, int** T) {**R = 10; *p = 4; **T = 6; *q = 5; R = T; *R = q; **T = 6;}/*yet_another_function */int main (void) {int x = 0; int y = 0; int* A = &x; int* B = &y; int** C = &A; int** D = &B; printf("x = %d, y = %d ", x, y); yet_another_function(A, B, C, D); printf("x = %d, y = %d ", x, y); return EXIT_SUCCESS;}/* main */

Explanation / Answer

/* I have explained the functionality of each line of statement,i.e how the output is coming is correctly explained,Please do let me know in case of any doubt,would glad to help ,Thanks!! */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void yet_another_function(int* p,int* q,int** R,int** T){
/* p=A,q=B,R=C,T=D */
**R=10; /* due to this x now has the 10 stored in it */
*p=4; /* due to this x now has 4 stored in it */
*T=p; /* now A and D pointing to the same element i.e x */
**T=6; /* due to this x now has the 6 stored in it */
*q=5; /* due to this y now has the 5 stored in it */
R=T; /* R and T now same */
*R=q; /* C is similar to B i.e pointing to y */
**T=6; /* due to this y now has the 6 stored in it */
   /* after this line now x=6 and y=6 */
}

int main()
{int x=0;
int y=0;
int* A=&x; /* pointer A pointing to x */
int* B=&y; /* pointer B pointing to y */
int** C=&A; /* pointer C pointing to A */
int** D=&B; /* pointer D pointing to B */

printf("x=%d,y=%d ",x,y); /* it will print the initial value of x and y i.e 0 and 0 respectively */
yet_another_function(A,B,C,D); /* calling method yet_another_function ,program now enter into the method yet_another_function */
   /* yet_another_function filled the 6 in each x and y */
  
printf("x=%d,y=%d ",x,y); /* new value of x and y is printed i.e x=6 and y=6 */

return EXIT_SUCCESS;
}

OUTPUT:

x=0,y=0   

x=6,y=6