hi all
can someone please explain whey this buble sort doesnt work. Many thanks
Code:#include <stdio.h> int main(int argc, char *argv[]){ int a,b; int array[4]; int i; int swapped; printf("Enter 5 integers\n"); for (i=0;i<4; i++){ scanf("%d", &a); array[i]=a; printf("%d", array[i]); } swapped=1; while (swapped){ swapped=0; for (i=0;(i<4)&&(swapped=0); i++){ if (array[i]>array[i+1]){ b=array[i]; array[i]=array[i+1]; array[i+1]=b; swapped=1; } printf("%d\n", array[i]); } return 0; }}