Pointers


  1. Which of following logical operation can be applied to pointers?
    (Assuming initialization int *p = 12; int *q = 13;)











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    None of these


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    char *str = "PRAYAG";
    char *ptr = str;
    printf("%c %c", *ptr, str[2]);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    P A



  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    char *str = "AJIT";
    char *ptr = str;
    printf("%c %c", *(ptr + 2), str[2]);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    I I


  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    char *str = "InterviewMania";
    char *ntr = "Mania";
    char *ptr = str + ntr;
    printf("%c\t%c", *ptr, str[1]);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Compilation Error

    main.c: In function ‘main’:
    main.c:6:25: error: invalid operands to binary + (have ‘char *’ and ‘char *’)
    char *ptr = str + ntr;



  1. What is the size of *p in a 32-bit machine (Assuming initialization as int *p = 12;)?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    4