Pointers


  1. What is the output of this C code?
    #include <stdio.h>
    int main()
    {
    char *p[1] = {"Interview Mania"};
    printf("%s", (p)[0]);
    return 0;
    }









  1. View Hint View Answer Discuss in Forum

    {"Interview Mania"} denotes an array of strings and char *p [1] is declaring an array to hold 1 character pointer.

    Correct Option: C

    The output will be “Interview Mania”. Here is why:

    {"Interview Mania"} denotes an array of strings and char *p [1] is declaring an array to hold 1 character pointer. The assignment operator will make the first character pointer point to "Interview Mania".