A
almurph
Hi everyone,
Hope you can help me with this one and its not too left field. I have
some pre-99 C code that requires translation into C#. The C code
involves pointers and the translation does not use any. The
translatino also tries to simplfy the C code into a kind of easier to
read code.
I would apprecte your comments/suggestions/suggestions/blessings to
make sure I'm on the right track. Oh BTW, it should be noted that
Weight below is an array of type double.
Thanking you,
Al.
*** BEGIN C LANGUAGE CODE ***
int A, B;
double *Wb, *Wa;
double Sum=0.0;
for ( Wb = Weight + B, Wa = Weight + A ; Wb <= Wa ; )
{
Sum += *Wb++;
}
*** END C LANGUAGE CODE ***
*** BEGIN C# ATTEMPT ***
double Sum = 0.0;
double Wt_Value;
for (double Wt = Weight; Wt <= Weight[A]; Wt++)
{
Wt_Value = Wt;
Sum = Sum + Wt_Value;
Wt = Wt + 1;
}
return Sum;
*** END C# ATTEMPT ***
Hope you can help me with this one and its not too left field. I have
some pre-99 C code that requires translation into C#. The C code
involves pointers and the translation does not use any. The
translatino also tries to simplfy the C code into a kind of easier to
read code.
I would apprecte your comments/suggestions/suggestions/blessings to
make sure I'm on the right track. Oh BTW, it should be noted that
Weight below is an array of type double.
Thanking you,
Al.
*** BEGIN C LANGUAGE CODE ***
int A, B;
double *Wb, *Wa;
double Sum=0.0;
for ( Wb = Weight + B, Wa = Weight + A ; Wb <= Wa ; )
{
Sum += *Wb++;
}
*** END C LANGUAGE CODE ***
*** BEGIN C# ATTEMPT ***
double Sum = 0.0;
double Wt_Value;
for (double Wt = Weight; Wt <= Weight[A]; Wt++)
{
Wt_Value = Wt;
Sum = Sum + Wt_Value;
Wt = Wt + 1;
}
return Sum;
*** END C# ATTEMPT ***