C | Operators | Question 27
Predict the output of following C program
#include <stdio.h> int main() { int i = 0; do { printf("GeeqsQuiz "); i = i++; } while (i < 5); return 0; } |
chevron_right
filter_none
(A) GeeqsQuiz GeeqsQuiz GeeqsQuiz GeeqsQuiz GeeqsQuiz
(B) Infinite time GeeksQuiz
(C) Undefined Behavior
Answer: (C)
Explanation: The below statement causes undefined behavior.
i = i++;
See https://www.geeksforgeeks.org/sequence-points-in-c-set-1/ for details.
Quiz of this Question
Recommended Posts:
- Operators in C | Set 2 (Relational and Logical Operators)
- C | Operators | Question 4
- C | Operators | Question 26
- C | Operators | Question 21
- C | Operators | Question 3
- C | Operators | Question 2
- C | Operators | Question 17
- C | Operators | Question 18
- C | Operators | Question 27
- C | Operators | Question 13
- C | Operators | Question 12
- C | Operators | Question 11
- C | Operators | Question 10
- C | Operators | Question 16
- C | Operators | Question 22



