I've written a program but I don't know whether my comments are correct, suitable or missing. Please help me to check , I've put the "??" because I'm not sure about it.
This is my code
Code:
#include <stdio.h>
/* function main begins program execution */
int main ()
{
int i, j, tmp; /* initialize integers */
int num[10] = {5,6,3,2,8,9,0,4,1,7}; /* 10 unsorted arrays */
for (i = 1; i < 10; i++) /* number of loops */
{
for ( j = 0; j < 10; j++) /* ?? */
if (num[j] > num[j+1]) /* ?? */
{
tmp = num[j]; /* bubble sort formula */
num[j] = num[j+1];
num[j+1] = tmp;
}
printf("loop %d", i); /* prints loop */
for (j = 0; j < 10; j++) /* total numbers in a loop */
printf("%4d", num[j]); /* prints distance between numbers */
printf("\n"); /* begin new output line */
} /* end outer for */
} /* end function main */