What is the output of the following ‘c’ code assuming it runs on a byte…

ISRO Scientist/Engineer SC 2020

What is the output of the following ‘c’ code assuming it runs on a byte addressed little endian machine?

C
#include <stdio.h>
int main( )
 {
   int x; char *ptr;
   x = 622,100,101;
   printf("%d", (*(char *)&x) * (x % 3));
   return 0;
 } 
  1. A.

    622

  2. B.

    311

  3. C.

    22

  4. D.

    110

Attempted by 511 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…