Home / CSE MCQs / C-MCQs :: Discussion

Discussion :: C-MCQs

  1. What is the output of this C code (on a 32-bit machine)?

        int main()
        {
            int x = 10000;
            double y = 56;
            int *p = &x;
            double *q = &y;
            printf("p and q are %d and %d", sizeof(p), sizeof(q));
            return 0;
        }
  2. A.
    p and q are 4 and 4
    B.
    p and q are 4 and 8
    C.
    Compiler error
    D.
    p and q are 2 and 8

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    Size of any type of pointer is 4 on a 32-bit machine.
    Output:
    $ cc pgm6.c
    $ a.out
    p and q are 4 and 4


Be The First To Comment