I have two structs, and a function. I want to be able to pass back the expression in the function to my main program. But it is a multi-dimensional array... since I am trying to print it out...
//Setting the struct up for the pixel's
struct pixel
{
unsigned char red;
unsigned char green;
unsigned char blue;
};
//Setting the struct up for the Image Type and scanning in the pixels into an array
struct ImageType
{
char ppImage[3];
char comment[256];
char newlinechar;
int width, height;
int maxColor;
struct pixel image[256][256];
};
My function
//Function in order to flip the image, going from the left most pixel flipping with the right most
void MirrorVertical(struct ImageType imgur)
{
int x, y;
for(x=0; x < imgur.width; x++)
{
for(y=0; y < imgur.height; y++)
{
imgur.image[x][y]=imgur.image[(imgur.width*imgur.width)-x-1][y];
}
}
}
@nhgrif I originally had it as this
for(x=0; x < imgur.width; x++)
{
for(y=0; y < imgur.height/2; y++)
{
temp = imgur.image[x][y];
imgur.image[x][y] = imgur.image[x][imgur.height-y-1];
imgur.image[x][imgur.height-y-1] = temp;
}
}
}
Where temp was the defined as the struct pixel temp; as a place to hold it.