Open In App

C | Operators | Question 27

Like Article
Like
Save
Share
Report

Predict the output of following C program 

C




#include <stdio.h>
int main()
{
    int i = 0;
    do
    {
        printf(\"GeeqsQuiz \");
        i = i++;
    }
    while (i < 5);
    return 0;
}


(A)

GeeqsQuiz GeeqsQuiz GeeqsQuiz GeeqsQuiz GeeqsQuiz

(B)

Infinite time GeeksQuiz

(C)

Undefined Behavior

(D)

None of the above



Answer: (C)

Explanation:

The below statement causes undefined behavior.

 i = i++;


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads