J
Jens Thiel
....or what am I doing wrong with the the i++ increment operator?
/*
compile with /clr
Output (compiled with VS.NET 2003, Framework 1.1) is:
r=0, i=0
r=1, i=0
r=2, i=0
*/
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
Int32 i1[] = { 1, 2, 3, 4, 5 ,6 };
Int32 i2[,] = new Int32[3, 2];
for( int i=0, r=0; r<3; r++ )
{
i2[r,0] = i1[i++];
i2[r,1] = i1[i++];
Console::WriteLine( String::Format(
S"r={0}, i={1}", r.ToString(), i.ToString() ) );
}
Console::ReadLine();
return 0;
}
/*
compile with /clr
Output (compiled with VS.NET 2003, Framework 1.1) is:
r=0, i=0
r=1, i=0
r=2, i=0
*/
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
Int32 i1[] = { 1, 2, 3, 4, 5 ,6 };
Int32 i2[,] = new Int32[3, 2];
for( int i=0, r=0; r<3; r++ )
{
i2[r,0] = i1[i++];
i2[r,1] = i1[i++];
Console::WriteLine( String::Format(
S"r={0}, i={1}", r.ToString(), i.ToString() ) );
}
Console::ReadLine();
return 0;
}