Inverse Matrix


Simple question. How do you calculate the inverse of a matrix using C/C++ code? I have read lots of articles explaing in excruciating detail about the inverse matrix and how to work it out on paper by doing lots of divides to find the identity matrix and getting the inverse from that but how do you calculate this in code? Do you have to calculate for 4x4 matrices or can you just calculate the inverse of the 3x3 component of a 4x4 matrix??