Hello every one,
I new to programming and to this message board. I've been working on a simple program that balences chemical equations. I'm having problems with a part of the program where I use an insertion sort algrithm. can you guys have a look at the code for me, I know I must be doing somthing wrong but I have no idea what. The Store[][3] values are some how getting corrupted, they equal Store[][0] for some reason.

Code:
	int i = 0; //Loop Varibles
	int k = 0;
	int key = 0;		// current value working on
	int SH = 0;			// the somthing happeded! flag for Duplicate removal

	for(i = 1; i <= Length; i++)
	{
		key = Store[i][1];

		k = i-1;
		

	//////////////////////
		while( Store[k][1] > key)	//go through the loop backwards moving data up
		{
			Store[k + 1][0] = Store[k][0];	//move a value up one in the list
			Store[k + 1][1] = Store[k][1];
			Store[k + 1][2] = Store[k][2];
			Store[k + 1][3] = Store[k][3];
			
			if(k == 0)			//when loop reaches bottom
				{
					Store[k][0] = Store[i][0];	//moves entry k down	
					Store[k][1] = key;			
					Store[k][2] = Store[i][2];
					Store[k][3] = Store[i][3];
				}

			k--;								//the while loop varible decrements

		}
	//////////////////////

	Store[k + 1][0] = Store[i][0];
	Store[k + 1][1] = key;			
	Store[k + 1][2] = Store[i][2];
	Store[k + 1][3] = Store[i][3];
	}