When we declare local variables, they are not initialized. Their values are undetermined. Trying to access
uninitialized variables causes
undefined behavior. One use case would be trying to print local, uninitialized variables. The following example demonstrates what should be avoided:
int main(void)
{
char c;
int x;
double d;
printf("Accessing uninitialized variables...\n");
printf("%c, %d, %f\n", c, x, d); // undefined behavior
}
Possible Output:Accessing uninitialized variables...
[, 32767, 0.000000
In this example, ...