Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

C | Loops & Control Structure | Question 1

  • Difficulty Level : Easy
  • Last Updated : 09 Jan, 2013

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.

#include <stdio.h>
int main()
    int i = 1024;
    for (; i; i >>= 1)
    return 0;

How many times will GeeksQuiz be printed in the above program?
(A) 10
(B) 11
(C) Infinite
(D) The program will show compile-time error

Answer: (B)

Explanation: In for loop, mentioning expression is optional. >>= is a composite operator. It shifts the binary representation of the value by 1 to the right and assigns the resulting value to the same variable. The for loop is executed until value of variable i doesn’t drop to 0.

My Personal Notes arrow_drop_up
Recommended Articles
Page :