/* FILE asarray.c */ #include #include "asarray.h" /* struct contains an int array */ void init_starray ( int aSize, struct starray **stA ) { int _j_; (*stA)->s_val= -1; (*stA)->s_arr=(int*)(malloc(aSize*sizeof(int))); (*stA)->f_arr=(float*)(malloc(aSize*sizeof(float))); for(_j_=0;_j_s_arr[_j_]=-1; (*stA)->f_arr[_j_]=-1.0; } } void alter_starray ( int aSize, struct starray **stA ) { int _j_; (*stA)->s_val= -2; for(_j_=0;_j_s_arr[_j_]=-2; (*stA)->f_arr[_j_]=-2.0; } } void print_starray ( char* ctext, int aSize, const struct starray *stA, FILE* ofile ) { int _j_; fprintf(ofile,"\n%s\t%d\t",ctext,aSize);fflush(ofile); for(_j_=0;_j_s_arr[_j_]);fflush(ofile); fprintf(ofile,"%f\t",stA->f_arr[_j_]);fflush(ofile); } } /* EOF */