Q. What will be the output of the following code?

Code:
#include <stdio.h>
int main() {
    int a = 5;
    printf("%d", a++);
    return 0;
}
  • (A) 5
  • (B) 6
  • (C) Compiler Error
  • (D) Garbage Value
πŸ’¬ Discuss
βœ… Correct Answer: (A) 5
Explanation: Post-increment returns the original value before incrementing, so 'a++' prints 5.
Explanation by: Mr. Dubey
Post-increment returns the original value before incrementing, so 'a++' prints 5.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
64
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
95%
Success Rate