Article ID: 155160
Article Last Modified on 12/10/2003
{,main.cpp,}i
{,Func1.cpp,}i
Single-step through the code and notice that even though the two variables
actually contain different values at all times, they are always displayed
with the same value--the value of "i" in Main.cpp.
// file main.cpp
// Compile options needed: /Zi
// main.cpp
void Func1(int);
int i=1;
int main()
{
i = 200;
Func1 (i);
return 0;
}
// end of file main.cpp
// file Func1.cpp
// Compile options needed: none
// Func1.cpp
#include <stdio.h>
float i=2.0f;
void Func1(int n)
{
printf("\n n= %d",n);
i = float(n+2);
printf("\n hPf= %f", i);
}
// end of file Func1.cpp
Additional query words: kbVC420bug 10.20
Keywords: kbbug kbfix kbvc500fix kbcompiler KB155160