Whenever you buy a home, you should have a professional home inspection performed.
A home inspection will look at the systems that make up the building such as:
Structural elements, foundation, framing etc
Plumbing systems
Roofing
Electrical systems
Cosmetic condition, paint, siding etc
When you buy a home, you need to know exactly what you are getting. A home inspection, performed by a professional home inspector, will reveal any hidden problems with the home so that they may be addressed BEFORE the deal is closed. You should require an inspection at the time you make a formal offer. Make sure the contract has an inspection contingency. Then, hire your own inspector and pay close attention to the inspection report.