This code works.Code:#include <stdio.h> void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } int main(void) { int executer[8] = {7, 5, 2, 0, 1, 6, 4, 3}; int x, y, j; for(x = 0; x < 8; x++) for(y = 0; y < 7; y++) if(executer[y] > executer[y+1]) swap(&executer[y], &executer[y+1]); for(j = 0; j < 8; j++) printf("%d\n", executer[j]); getchar(); return 0; }
But why 7 and not 8?