Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Pi

Name: Anonymous 2010-06-03 14:55

int a=10000,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5;
for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)for(b=c;d+=f[b]*a,
f[b]=d%--g,d/=g--,--b;d*=b);}

Name: Anonymous 2010-06-05 10:22

int a = 10000, b, c=2800, d, e, f[2801], g;
main()
{
   for(; b - c; )
   {
      f[b++] = a/5;
   }
   for(; d = 0, g = c*2 ; c -= 14, printf("%.4d",e+d/a),e=d%a)
   {
      for(b = c; d += f[b]*a, f[b] = d%--g, d /= g--, --b; d *= b);
   }
}


>>6
For starters, four of your variables remain uninitialized (only SOME systems accept that) and all of your loops are broken in some way.  For your first loop, you are probably hoping that b is auto-initialized to 0 and that the loop will terminate when b - c is equal to 2800 - 2800; in practice, b will be initialized to whatever junk data is stored at the memory location allocated for b and should not be trusted.  It could be a negative number and that would try to access array data at negative indices.  The same goes for all uninitialized variables.

For your second loop, it lacks a proper conditional statement and statements that should have been placed in the initialization block are in the conditional block.

The third loop also lacks a test condition statement.  I'm going to make a guess but based on what it looks like one of the conditional statements should be whether b is less than zero.  This is just a shot in the dark:

for(b = c; b >= 0 && ...; d += f[b]*a, f[b] = d%--g, d /= g--, --b, d *= b);

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List