Pointers


  1. Which type of variables can have same name in different function?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Both static variables and Function arguments


  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. 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. 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. What will be the output of the following C code?
     #include <stdio.h>
    int main()
    {
    int num = 12;
    int *ptr = #
    foo(&ptr);
    printf("%d ", *ptr);
    printf("%d ", *ptr);
    }
    void foo(int **const ptr)
    {
    int k = 13;
    *ptr = &k;
    printf("%d ", **ptr);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    13 13 13