QP School
Not initializing variables in C - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32)
+--- Thread: Not initializing variables in C (/showthread.php?tid=5115)



Not initializing variables in C - Qomplainerz - 07-26-2023

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