Pointers


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    char *ptr1= "Interview Mania";
    char *ptr2 = ptr1;
    printf("%c %c", ptr2[0], ptr1[10]);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    I M


  1. What will be the output of the following C code?
     #include <stdio.h>
    void main()
    {
    char *ptr1 = "Interview Mania";
    char *ptr2 = ptr1;
    printf("%p %p", ptr2, ptr1);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Same memory address is printed



  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int arr[4] = {11, 12, 13, 14};
    int *ptr = arr;
    printf("%p\t%p", ptr, arr);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Same memory address is printed


  1. What will be the output of the following C code?
    #include <stdio.h>
    void count(int m, int n)
    {
    printf("%d\n", m);
    }
    void main()
    {
    int i = 12, j = 11;
    count(i, j);
    printf("%d %d\n", i, j);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    12
    12 11



  1. What will be the output of the following C code?
    #include <stdio.h>
    void function(int m, int n)
    {
    printf("%d %d\n", m, n);
    }
    void main()
    {
    int s = 16, t = 15;
    function(s);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    Compilation Error

    main.c: In function ‘main’:
    main.c:9:9: error: too few arguments to function ‘function’
    function(s);
    ^~~~~~~~
    main.c:2:10: note: declared here
    void function(int m, int n)