DISCLAIMER: I don't want direct guidance of what to do, just to be offered some (probably cryptic) direction.
I've been tasked with a programme to reverse the elements in an array
Code:
for (int i = 0; i <= height; i++)
{
for (int j = 0; j <= width; j++)
{
//takes jth pixel into temp
var temp = image[i][j];
//puts last pixel into jth place
image[i][j] = image[i][j-1];
//puts first pixel into last place
image[i][j-1] = temp;
}
}
This chunk of code seemingly swaps the first and last elements, but obviously not the rest of them. Can someone point me in the right direction?