retagged by
447 views
3 votes
3 votes

What will be the output of the following C program?

#include<stdio.h>
int main()
{
    static int p[] = {1, 2, 3, 0, 5, 6};
    static int *q[] = {p+2, p+1, p, p+3, p+4, p+5};
    static int **r[] = {q+4, q+5, q+1, q, q+2, q+3};
    int ***pt;
    pt = r + 2;
    printf("%d", ***(pt+3)-**(q+1));
}
retagged by

1 Answer

3 votes
3 votes
$***(pt+3) - **(q+1)$

$\qquad = ***(pt+3) - **(q+1)$

$\qquad = (* (* (*(r + 2 + 3)))) – (*(*(q+1)))$

$\qquad = (*(*(q+3))) – (*(p+1))$

$\qquad = 0 – 2$

$\qquad= -2$
Answer:

Related questions