/* pascalstriangle.c */ /* © Copyright 2003 Dauger Research, Inc. Our lawyers made us say this: DISCLAIMER: We provide the following on an "AS IS" basis. Use it at your own risk. */ #include /* standard I/O routines */ #include /* standard library routines, such as memory */ #include /* math libraries */ #define myType unsigned long /* Routines performing elemental work. */ void addright(myType *inputArray, long size); void addright(myType *inputArray, long size) { if (inputArray) { long i=size-1; while (i--) inputArray[i+1]+=inputArray[i]; } } void addleft(myType *inputArray, long size); void addleft(myType *inputArray, long size) { if (inputArray) { long i; for(i=0; i0) { long index; /* loop over indicies */ for(index=0; index>1]=1; /* propagate */ iterationloop(myArray, arraySize, binomalExponent, 2); } /* return the array */ *theArray=myArray; } #define BinomalExponent 30L int main(int argc, char *argv[]) { /* main copies of the sum and the array */ myType *theArray=NULL; printf("Beginning computation...\n"); computeloop(&theArray, BinomalExponent); if (theArray) {/* error checking */ FILE *fp; /* save the array into a data file */ fp=fopen("output", "w"); if (fp) { printf("writing array...\n"); fwrite(theArray, sizeof(myType), BinomalExponent+1, fp); fclose(fp); } if (1) {long i; for(i=0; i