looking at the program following,i don't know how the line7 is working(what's the j variable advantages?!)!!! i'm trying on arrays and know the concepts but i don't know exactly how to use them(of course in a more complex programs in which i should use more than one array and loops togather!!
Code:
main()
{
int i,a,j,num[10];
for(i = 0;i < 10;i++)
scanf("%d",&num[i]);
for(j = 0;j < 9;j++)
for(i = 0;i < 10-j;i++)
if(num[i] > num[i+1]){
a = num[i];
num[i] = num[i+1];
num[i+1] = a;
}
printf("\n\n");
for(i = 0;i < 10;i++)
printf("%d\n",num[i]);
}
tnx.