Machine-translated by Google. Questions are authored in English.
Top

Discussion

p++ executes faster than p + 1 since

  • A.P uses registers
  • B.Single machine instruction required for p++
  • C.Option a and b
  • D.None

Answer: B

Correct answer: Single machine instruction required for p++

p++ maps to a single increment instruction that updates p in place, whereas p + 1 computes a new value that then has to be stored somewhere. The saving is historical, though: any modern optimising compiler generates identical code for p = p + 1 and p++.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.