You must be using a non-std compiler if this code compiles because you can't write arrays like you have with a std c++ compiler.
This can be done by defining the operator< for your struct and using the std::sort algorithm. std::sort can't be any less efficient than what you wrote. In fact it is probably a lot faster and less error prone. The following article contains an example on how to do this. Although it is more complex, the concept works with simple structs as well. http://cplusplus.com/forum/articles/10879/