Pointers


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int n = 12;
    int *const ptr = &n;
    function(&ptr);
    printf("%d\n", *ptr);
    }
    void function(int **ptr)
    {
    int k = 15;
    *ptr = &k;
    printf("%d\n", **ptr);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    15
    15


  1. Which of the following is the correct syntax to send an array as a parameter to function?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    function(&arr);



  1. Which of the following can never be sent by call-by-value?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Array


  1. What is the maximum number of arguments that can be passed in a single function?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    253



  1. What will be the output of the following C code?
    #include <stdio.h>
    void fun(int *ptr)
    {
    int k = 0;
    for(k = 0; k < 4; k++)
    printf("%d ", ptr[k]);
    }
    void main()
    {
    int n[5] = {16, 15, 13, 21};
    fun(&n);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    16 15 13 21