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


Messages In This Thread
Not initializing variables in C - by Qomplainerz - 07-26-2023, 07:07 AM

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: 4 Guest(s)