C - What is the output: for loop condition?

Question

What is the output of the following code?

#include <stdio.h> 

int main() 
{ 
   int x; 

   for(x=0;x=10;x=x+1) 
   { 
       puts("What are you lookin' at?"); 
   } 
   return(0); 
} 


Click to view the answer

Endless Loop

Note

The problem with the code is that the for statement's exit condition is always true: x=10.

To break out of an endless loop, press Ctrl+C on the keyboard.

Related Quiz