Pointers


  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. Comment on an array of the void data type.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    You cannot have an array of void data type



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    double *p = (double *)150;
    p = p + 5;
    printf("%u", p);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    190


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Compilation Error

    main.c: In function ‘main’:
    main.c:6:13: error: assignment to expression with array type
    ptr = num;



  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int array1[5] = {10, 20, 30, 40, 50};
    int array2[5] = {11, 21, 31, 41, 51};
    int R = &array2[3] - &array1[2];
    printf("%d\n", R);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    -7