What will be output of following program? Assume that you are running this…

ISRO Scientist/Engineer SC 2016

What will be output of following program? Assume that you are running this program in little-endian processor.

#include<stdio.h>

int main() {
    short a = 320;
    char * ptr;
    ptr = (char * ) & a;
    printf("%d", * ptr);
    return 0;
}
  1. A.

    1

  2. B.

    320

  3. C.

    64

  4. D.

    Compilation error

Attempted by 771 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…