Whether you are buying or selling 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.
Cosmetic condition, paint, siding etc
If you are buying 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. If you aren't comfortable with what he finds, you should kill the deal.
Likewise, if you are selling a home, you want to know about such potential hidden problems before your house goes on the market. Almost all contracts include the condition that the contract is contingent upon completion of a satisfactory inspection. And most buyer's are going to insist that the inspection be a professional home inspection, usually by an inspector they hire. If the buyer's inspector finds a problem, it can cause the buyer to get cold feet and the deal can often fall through. At best, surprise problems uncovered by the buyer's inspector will cause delays in closing, and usually you will have to pay for repairs at the last minute, or take a lower price on your home.
It's better to pay for your own inspection before putting your home on the market. Find out about any hidden problems and correct them in advance. Otherwise, you can count on the buyer's inspector finding them, at the worst possible time.