Home / General Knowledge / Testing New :: Discussion

Discussion :: Testing New

  1. Determine output:

    #include <stdio.h>

    void main()

    {

    char *p = NULL;

    char *q = 0;

    if(p)

    printf(" p ");

    else

    printf("nullp");

    if(q)

    printf("q");

    else

    printf(" nullq");

    }

  2. A.

     p q

    B.

     Depends on the compiler

    C.

     x nullq where x can be p or nullp depending on the value of NULL

    D.

     nullp nullq

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    char *p = NULL is same as char *q = 0.
    In both declarations p and q are initialized to null.


Be The First To Comment