I'm developing a program for class that reads a matrix and then prints it with an identity matrix. Then step by step I have to reduce it into its identity matrix while applying the same calculations onto the identity matrix and therefore getting the inverse of that matrix. 

I'm stuck at the row reducing section of the code. I'm trying to create a loop that row reduces an nxn matrix into an identity matrix all in one shot instead of creating one for each column. I need some help with the loops that row reduces the matrix column by column. 

Anyone have any ideas. (I'm a beginner at programming, I'm using C language, posted solutions are okay, but I'm looking for an algorithm to take down all the row reducing in one shot).