Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using = instead of == in C
#1
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");
}
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)