94.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char *p = NULL;
    char *q = 0;
    if (p)
        printf(" p ");
    else
        printf("nullp");
    if (q)
        printf("q\n");
    else
        printf(" nullq\n");
}

95.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 97, *p = &i;
    foo(&i);
    printf("%d ", *p);
}
void foo(int *p)
{
    int j = 2;
    p = &j;
    printf("%d ", *p);
}

96.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int ary[2][3][4], j = 20;
    ary[0][0] = &j;
    printf("%d\n", *ary[0][0]);
}

97.
What will be the output of the following C code?
#include <stdio.h>
void m(int *p, int *q)
{
    int temp = *p; *p = *q; *q = temp;
}
void main()
{
    int a = 6, b = 5;
    m(&a, &b);
    printf("%d %d\n", a, b);
}

98.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 97, *p = &i;
    foo(&p);
    printf("%d ", *p);
    return 0;
}
void foo(int **p)
{
    int j = 2;
    *p = &j;
    printf("%d ", **p);
}

99.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    void *p;
    int a[4] = {1, 2, 3, 8};
    p = &a[3];
    int *ptr = &a[2];
    int n = p - ptr;
    printf("%d\n", n);
}

Read More Section(Pointer)

Each Section contains maximum 100 MCQs question on Pointer. To get more questions visit other sections.