Issue with value when exit loop

  • Thread starter Thread starter steve_tiger_03
  • Start date Start date
S

steve_tiger_03

Guest
I have this code which give me headache (with VS2017):

int nIndex = 0;
for( int i = 0, nIndex = 0; i < 20; i++ )
{
nIndex++;
}
TRACE( "%d\n", nIndex );

Why the nIndex value is 0 when it exit the loop?

Thanks,

Steve

Continue reading...
 
Back
Top