Grand-Master wrote:
Consider the following program:
#include <stdio.h>
int main( void )
{
int foo;
return 0;
}
How would I get this program to output an error message stating that the
variable foo was not assigned a value? Is there a special reserved
phrase that I can use in the fashion as EOF or NULL?
No; the value is indeterminate, and accessing it results in undefined
behaviour. Some compilers/environments may provide a mechanism to check
this at runtime, or may force some sort of program failure if it is
accessed, but that's implementation specific.
Some compilers have options to check for use of uninitialised variables
at compile time, but they don't always catch all cases, and often give
warnings for situations which are valid.