Here is a good guide to building a code stair.
http://www.stairways.org/pdf/2006%20Stair%20IRC%20SCREEN.pdf
(https://i56.photobucket.com/albums/g166/jraabe/stair-code.jpg)
We get into a 42" guard on commercial balconies - lofts -mezzanines I think and a max height on the stair rail at 38". Don't know how it works on houses.