0
Would u please check and tell me my mistakes on this program for bubble sorting a table ?
#include<stdio.h> int bsort(int size,int t[]); int main(){ int t[]={12,-3,5,-4,2,9}; int j,size; printf("give me the size of the table t"); scanf("%d",&size); bsort(size,t); printf("after sorting table"); for(j=0;j<size,j++){ printf("%d",t[j]); } return 0; } int bsort(int size,int t[]){ int i,j,x; for(i=0;i<size,i++){ for(j=size-1;j>i;j--){ if(t[j+1]<t[j]) x=t[j+1]; t[j+1]=t[j]; t[j]=x; } }
1 Antwort
+ 1
Learn from this one
https://www.sololearn.com/learn/649/?ref=app