Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using incorrect format specifiers in C
#1
Mismatching format specifiers with the data types can lead to undefined behavior or incorrect output.

// Incorrect
int x = 10;
printf("Value of x: %s\n", x); // Incorrect format specifier '%s' for integer

// Correct
int x = 10;
printf("Value of x: %d\n", x); // Output: Value of x: 10
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Incorrect loop conditions in C Qomplainerz 0 199 07-26-2023, 07:08 AM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 8 Guest(s)