Source code could potentially be a trade secret for a software company, but in order to qualify for protection it would have to be actively guarded and not disclosed to anyone outside of the company. Trade secret protection is really for something like a secret recipe that has great value to the company solely because it is a secret known only by the company.
A copyright is the better form of protection for software. As far as understanding what has been copyrighted — copyrights exist as soon as the work is fixed in a medium. So, any work (here, software) that you see has an implicit copyright on the original aspects of the work. The question of what parts of the work are original and thus protected by the copyright is a legal question that should be answered by an IP attorney.
For that reason most companies will have copyrights on their software to some extent. Patents on software are more difficult to obtain than copyrights for a couple of reasons. First, the patent application process requires a strict review to ensure that the application meets the requirements — as opposed to a copyright which exists as soon as an author puts pen to paper. Second, patents are generally reserved for tangible inventions. It is possible that software can qualify for a patent, but it is much harder to show.
I hope that answers your questions. At LawTrades, our intellectual property attorneys have experience in all areas of intellectual property law. Visit ourto see how we can help you!