🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

दिए गए C कोड में, लूप के लिए निष्पादित होता है:

In the given C code, for loop executes for:

 #include
 void main ()
 {
 int x=10;
for ( ; ; ) 
{ 
printf(“%d\n”,x):
}
 }
A)
B)
C)
D)

Explanation:

Let's analyze the provided C code:

Code:

#include 

void main() {
    int x = 10;
    for ( ; ; ) {
        printf("%d\n", x);
    }
}

Explanation:

  1. For Loop Structure: The for loop in the code has no condition specified:

    • The typical structure of a for loop is: for(initialization; condition; increment/decrement).
    • In this case, there is no initialization, no condition, and no increment or decrement. This effectively makes it an infinite loop since there is no termination condition.
  2. Inside the Loop:

    • The value of x (which is 10) is printed repeatedly in an infinite loop, with no condition to stop it.

Conclusion:

  • The loop will run forever because there is no exit condition.

Correct Answer:

(C) infinite.

Latest Updates