Pointers

61

What will be output of following program?


#include<stdio.h>
#include<string.h>
int main()
{
    int a = 5, b = 10, c;
    int *p  = &a,*q = &b;
    c = p - q;
    printf("%d",c);
    return 0;
}

A. 1
B. 5
C. -5
D. Compilation error
E. None of the above

62
What will be the output of the following program :

#include<stdio.h>
main()
{
	int val=1234;
	int* ptr=&val;
	printf("%d %d",val,(*ptr)++);
}

A. 1234 1234
B. 1235 1235
C. 1234 1235
D. 1235 1234

63
What will be the output of the following program :

#include<stdio.h>
main()
{
	int a=555,*ptr=&a,b=*ptr;
        printf("%d %d %d",a,--*&b,*ptr++);
}

A. Compile Error
B. 555 554 555
C. 556 554 555
D. 557 554 555

64

What will be output of following program?

#include<stdio.h>
int main()
{
     int i;
     int *j; 
     int **k; 
     j = &i;
     k = &j;
    printf("%u %u %u", i, j, k);
    return 0;
}

A. 3 Address 3
B. 3 Address Address
C. 3 3 3
D. Compilation error
E. None of the above