I am a newbie to C and I was wondering if someone has a small piece of code I could use to sort the following file input. I have made a small file with 11 social security numbers and I need these to be sorted in descending order and then displayed on the screen. Right now the data is displayed without sorting. Any help would be appreciated. Thanks.
Code:#include <stdio.h> #include <stdlib.h> int main(void) { int x, y[10]; FILE *fp; fp = fopen("testdat.txt","r"); for (x=0;x<10;x=x++) { fscanf(fp,"%d",&y[x]); printf("%d\n",y[x]); } fclose(fp); }