So uhm...I want to do the bubble sort and i found a code but actually i don't really know what's missing...ok...sorry but i am just a newbie and not so average of logic(lol. :p).
My goal here is to complete this code, 'cause i tried to run it but it has an error saying...
undefined symbol _main in module c0.ASM
and the code is :
Bubblesort (int data[],int n) {
int tmp,i,j;
for (i=0; i<n-1; i++) {
for (j=0; j<n-i-1; j++)
if (data[j] > data[j+1]) {
tmp = data[j];
data[j] = data[j+1];
data[j+1] = tmp;
}
}
getch();
return 0;
}
my questions now are:
-where to put the printf("Enter values: ");?
-in the scanf, what variable i would use? is it the i or j or i would create new variable?
-and is there more code to add other than the printf(inputed value),scanf(inputed value)?
-of course i would display the sorted list but, where to put the printf(output) and what to put in the printf(output)?
-what does this mean (i=0; i<n-1; i++), (the red one)
---
i would really deeply appreciate if anyone can help me~ please~ *praying* TT_TT
also, sorry for asking so many questions.