As Shadowbox says, copyright is for specific expressions - whether that be text, music, photography, etc. Code falls under text and as such is copyrighted to the author as soon as it is written in most countries - you do not normally need to register copyright.
Patents are there to protect new and novel technologies and processes. For example, making a social network for astronauts would not be patentable per se, as it is an obvious extension of the idea of group social networks like those for everyone, or just women, or just member of the military, etc. But if to register to become a member of that astronaut social network, the service would scan the astronaut's helmet and use some unique identifier from that to prove the person is an astronaut - then this sign-up process could be patented as it would be a new and novel process. General ideas can be worth working on from a business perspective, but they cannot be patented.
Contrary to popular belief, you cannot protect an idea - and ideas are not really worth much tbh. It is the expression of that idea that is important as a product or service more than anything else.