07-26-2023, 07:09 AM
Assigning a value using = instead of comparing with == in conditional statements.
// Incorrect
int x = 5;
if (x = 10) {
printf("x is 10\n");
}
// Correct
int x = 5;
if (x == 10) {
printf("x is 10\n");
}
// Incorrect
int x = 5;
if (x = 10) {
printf("x is 10\n");
}
// Correct
int x = 5;
if (x == 10) {
printf("x is 10\n");
}
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos