hey guys i am trying to do one level of undo ..however its not working correctly..it does display the text but x and y axis gets messed up..any help and suggestion be great
thank you

void undo(pixeltype pixels[], int length, int option) {
	struct temp_pixels {
		int x;
		int y;
		char c;};
	temp_pixels temp[6000];
	if (option !=9) {		//copy one level of pixels location(x,y) 
		int i = 0;
		do {
			temp[i].x=pixels[i].x;
			temp[i].y=pixels[i].y;
			i++;
		}while(i<length);
	}
	else {		//run this if user picks UNDO in Menu
		int i = 0;
		do {
			pixels[i].x=temp[i].x;
			pixels[i].y=temp[i].y;
			i++;
			//pixels[i].c=temp[i].c;
		}while (i<length);
		drawImage(pixels,length);
		operations(menu(), pixels, length);
	}
	
}