Skip to content
Related Articles
Open in App
Not now

Related Articles

C | C Quiz – 113 | Question 1

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 28 Jun, 2021
Improve Article
Save Article

#include <stdio.h>
int main()
    unsigned int i = 65000;
    while (i++ != 0);
    printf("%d", i);
    return 0;

(A) Infinite Loop
(B) 0
(C) 1
(D) Run Time Error

Answer: (C)

Explanation: The result will be 1 but after a really long time because while loop will keep on going until i becomes 4294967295 (Assuming unsigned int is stored using 4 bytes) and as i highest limit of unsigned int is 4294967295 in next ++ operation it will become zero and we’ll come out of loop and 1 will be printed.

Since the time taken is long, on-line compiler may terminate the program with time limit exceeded error. If instead of unsigned int, you use unsigned short int then result (1) may come faster.

Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!