Pointers


  1. Which of the following arithmetic operation can be applied to pointers p and q?
    (Assuming initialization as int *p = (int *)6; int *q = (int *)7;)











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    p – q


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    const int num[5] = {11, 21, 31, 41, 51};
    int *ptr;
    ptr = num + 3;
    *ptr = 50;
    printf("%d\n", num[3]);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    50



  1. What are the elements present in the array of the following C code?
    int num[4] = {10};











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    10, 0, 0, 0


  1. What are the different ways to initialize an array with all elements as zero?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Option A, B and C are the different ways to initialize an array with all elements as zero.



  1. Which of the following declaration is illegal?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    int size = 5;
    int num[size] = {11, 12, 13, 14, 15};