- 论坛徽章:
- 145
|
回复 8# sxcong
Uninitialized variable
http://en.wikipedia.org/wiki/Uninitialized_variable
In computing, an uninitialized variable is a variable that is declared but is not set to a definite known value before it is used. It will have some value, but not a predictable one. As such, it is a programming error and a common source of bugs in software.
...
void count( void )
{
int k, i;
for (i = 0; i < 10; i++)
{
k = k + 1;
}
printf("%d", k);
}
What is the final value of k? The fact is, it is extremely difficult to tell. The answer that it must be 10 assumes that it started at zero, which may or may not be true. Note that in the example, the variable i is initialized to zero by the first clause of the for statement.
...
|
|