This isn't going to answer your question, but...
Do yourself (and us) a massive favour and indent your code.
It is much, much easier to read - and to work out what is going on - when it looks like this:
for(int j=0;j<20;++j){
for(int i=0;i<10;++i){
if(chart1[i+1][2]>chart1[i][2]){
temp[0]=chart1[i][0];
temp[1]=chart1[i][1];
temp[2]=chart1[i][2];
temp[3]=chart1[i][3];
chart1[i][0]=chart1[i+1][0];
chart1[i][1]=chart1[i+1][1];
chart1[i][2]=chart1[i+1][2];
chart1[i][3]=chart1[i+1][3];
chart1[i+1][0]=temp[0];
chart1[i+1][1]=temp[1];
chart1[i+1][2]=temp[2];
chart1[i+1][3]=temp[3];
}
}
}
Than when all the code is flat to the LHS of the screen...