QP School

Full Version: Not initializing variables in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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