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

Monday, 12 July 2021

Interview Hack#45 Answer

What will be output if you will execute following c code?

  1. 22
  2. 23
  3. 43
  4. 44
  5. Error

Correct answer 4) 44

Explanation:
Consider on expression:
= ++arr[++x] + ++x + arr[--x] //x = 0 + 1
= ++arr[1] + ++x + arr[--x] //x = 1 + 1
= ++arr[++x] + 2 + arr[--x] //x = 2 - 1
= ++arr[1] + 2 + arr[1] //arr[1] = 20+1
= arr[1] + 1 + arr[1] //arr[1] = 21
= 21 + 2 + 21
= 44

1 comment:

  1. Harrah's Casino and Resort - Mapyro
    Harrah's is a 순천 출장마사지 luxury 전라북도 출장안마 hotel and casino located in 과천 출장마사지 the heart of Las Vegas. The 구리 출장샵 hotel, located on the site of a $330 million 부천 출장샵 renovation, features 392 guest rooms

    ReplyDelete