Pointers


  1. What type of initialization is needed for the segment “p[3] = ‘3’;” to work?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    char p[] = “Interview!”;


  1. What is the syntax for constant pointer to address (i.e., fixed pointer address)?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    <type> * const <name>



  1. Calling a function fun with num an array variable num[3] where num is an array, is equivalent to __________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Option A, B and C is equivalent.


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    char str[] = "WELCOME";
    str++;
    printf("%c\n", *str);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Compilation Error

    main.c: In function ‘main’:
    main.c:5:12: error: lvalue required as increment operand
    str++;



  1. What will be the output of the following C code?
     #include <stdio.h>
    void count(char *ptr)
    {
    ptr++;
    ptr[3] = 'S';
    }
    void main()
    {
    char str[] = "AJIT";
    count(str);
    printf("%c\n", *str);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    A