[fpc-pascal] converting c code

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Sun May 13 18:22:07 CEST 2012


Thanks to all. I got the code working now.

Regards, Darius


On May 13, 2012, at 3:09 PM, Darius Blaszyk wrote:

> I'm struggling to convert a simple for loop from C to pascal. The code is shown below (as is a trace of the loop parameter values). I'm a bit puzzled how this should look elegantly in pascal. Anyone has an idea?
> 
> Regards, Darius
> 
> 
> unsigned nc = 4;	
> 
> for (unsigned i = 0, j = nc-1; i < nc; j=i++)
> {
> 	cout << "i:" << i << endl;
> 	cout << "j:" << j << endl;
> }
> 
> loop values are:
> i:0
> j:3
> i:1
> j:0
> i:2
> j:1
> i:3
> j:2_______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list