Step 1: int i = 0; here variable i is an integer type and initialized to '0'. Step 2: for(; i<=5; i++); variable i=0 is already assigned in previous step. The semi-colon at the end of this for loop tells, "there is no more statement is inside the loop".
Loop 1: here i=0, the condition in for(; 0<=5; i++) loop satisfies and then i is incremented by '1'(one) Loop 2: here i=1, the condition in for(; 1<=5; i++) loop satisfies and then i is incremented by '1'(one) Loop 3: here i=2, the condition in for(; 2<=5; i++) loop satisfies and then i is incremented by '1'(one) Loop 4: here i=3, the condition in for(; 3<=5; i++) loop satisfies and then i is increemented by '1'(one) Loop 5: here i=4, the condition in for(; 4<=5; i++) loop satisfies and then i is incremented by '1'(one) Loop 6: here i=5, the condition in for(; 5<=5; i++) loop satisfies and then i is incremented by '1'(one) Loop 7: here i=6, the condition in for(; 6<=5; i++) loop fails and then i is not incremented.
Step 3: printf("%d,", i); here the value of i is 6. Hence the output is '6'.
Step 1: char str[]="C-program"; here variable str contains "C-program". Step 2: int a = 5; here variable a contains "5". Step 3: printf(a >10?"Ps\n":"%s\n", str); this statement can be written as
Initially variables a = 500, b = 100 and c is not assigned.
Step 1: if(!a >= 400) Step 2: if(!500 >= 400) Step 3: if(0 >= 400) Step 4: if(FALSE) Hence the if condition is failed. Step 5: So, variable c is assigned to a value '200'. Step 6: printf("b = %d c = %d\n", b, c); It prints value of b and c.
Hence the output is "b = 100 c = 200"
Here unsigned int size is 2 bytes. It varies from 0,1,2,3, ... to 65535.
Step 1:unsigned int i = 65535;
Step 2: Loop 1: while(i++ != 0) this statement becomes while(65535 != 0). Hence the while(TRUE) condition is satisfied. Then the printf("%d", ++i); prints '1'(variable 'i' is already increemented by '1' in while statement and now increemented by '1' in printf statement)
Loop 2: while(i++ != 0) this statement becomes while(1 != 0). Hence the while(TRUE) condition is satisfied. Then the printf("%d", ++i); prints '3'(variable 'i' is already increemented by '1' in while statement and now increemented by '1' in printf statement)
....
....
The while loop will never stops executing, because variable i will never become '0'(zero). Hence it is an 'Infinite loop'.
Step 1: int x = 3; here variable x is an integer type and initialized to '3'. Step 2: float y = 3.0; here variable y is an float type and initialized to '3.0' Step 3: if(x == y) here we are comparing if(3 == 3.0) hence this condition is satisfied.
Hence it prints "x and y are equal".