In C, =
is the assignment operator, used to assign a value to a variable. For example, x = 5;
assigns the value 5
to the variable x
. On the other hand, ==
is the equality operator, used to compare two values for equality. It returns true (1) if the values are equal, and false (0) if they are not. For example, x == 5;
checks if the value of x
is equal to 5.