Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not initializing variables in C
#1
Using variables without initializing them can lead to unpredictable behavior.

// Incorrect
int x;
printf("%d\n", x); // The value of 'x' is undefined

// Correct
int x = 0;
printf("%d\n", x); // Output: 0
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
  Declaring and initializing arrays Qomplainerz 0 327 07-25-2023, 11:39 AM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 5 Guest(s)