Sample code for if statement with assignment operator in c:
Find the output of this program?
compile time error
run time error
"=" is an assignment operation. "==" is a comparison operation. if we use assignment operator in if condition, and if the assigned value is non-zero then it returns true which satisfies the if condition. so it prints "equal".
Back To Top