#include #include #include int compare( const void* a, const void* b) { int int_a = * ( (int*) a ); int int_b = * ( (int*) b ); if ( int_a < int_b ) return -1; else if ( int_a > int_b ) return 1; else return 0; } int main(int argsc, char ** args){ if (argsc!=4){ fprintf(stderr,"Invalid or no arguments.\n"); exit(1); } int si = atoi(args[1]); /*simulation time*/ double sa = atof(args[2]); /*sample time*/ int lastOne = atoi(args[3]); /*indication that there is a one more sample*/ int count = (int)floor(si/sa) + lastOne; int index = 0; int sample; int * samples = malloc(count*sizeof(int)); while(scanf("%d",&sample)!=EOF){ if (index