Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

C | Loops & Control Structure | Question 19

  • Difficulty Level : Basic
  • Last Updated : 28 Jun, 2021
Geek Week




#include <stdio.h>
int main()
{
    int i = 3;
    while (i--)
    {
        int i = 100;
        i--;
        printf("%d ", i);
    }
    return 0;
}

(A) Infinite Loop
(B) 99 99 99
(C) 99 98 97
(D) 2 2 2


Answer: (B)

Explanation: Note that the iā€“- in the statement while(i-ā€“) changes the i of main()
And i== just after declaration statement int i=100; changes local i of while loop.

Quiz of this Question

Take a step-up from those “Hello World” programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.
My Personal Notes arrow_drop_up
Recommended Articles
Page :