The condition in the if statement
if(i=5 && j>5)
is equivalent to
if( i = ( 5 && j>5 ))
As 5 is not equal to 0 and j is indeed greater than 5 then the expression ( 5 && j>5 )
evaluates to 1
and is assigned to the variable i
.
From the C Standard (6.5.16 Assignment operators)
3 An assignment operator stores a value in the object designated by
the left operand. An assignment expression has the value of the left
operand after the assignment...
So as the value of the variable i
is equal to 1
then the if condition is executed.
It seems you mean
if(i==5 && j>5)
^^^^
Take into account that according to the C Standard the function main without parameters shall be declared like
int main( void )