Interviews Questions, Algorithms, Aptitude, C Interview Program, C Theory Question, Aptitude Tricks, Test Series,

Monday 28 June 2021

Interview Hack#31

What will be the output of the following program?

  1. 320
  2. 3
  3. 64
  4. Compilation error
  5. None Of These

Correct answer 64

Explanation:
we know int is a 4-byte data byte while char is a 1-byte data byte. char pointer can keep the address one byte at a time.

The binary value of 320 is
00000000 00000000 00000001 01000000 (In 64 bit)

So ptr is pointing only the first 8 bit and the Decimal value is 64.

0 comments:

Post a Comment