constint size = 5;
int main()
{
int i, j, a, tmp = 0;
int table[size];
for(i=0; i <size; i++)
{
cout << "enter num: ";
cin >> table[i];
}
for(a=0; a <size; a++)
for(j=0; j<size; j++)
{
if(table[a] > table[a+1])
{ tmp = table[a];
table[a] = table[a+1];
table[a+1] = tmp;
}
}
for(j=0; j<size; j++)
cout << table[i];
return 0;
}
Can you please tell me what's the wrong in my code?
I debug it but the "table[size] was corrupted" that is the message which is show me again and again..
I want to sort an array that's all! please help!