Would u please check and tell me my mistakes on this program for bubble sorting a table ? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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; } }

16th Apr 2021, 3:16 PM
Coderalgeria
Coderalgeria - avatar
1 Respuesta
16th Apr 2021, 3:56 PM
Ipang