Got asked this question today.
Firstly, I am not a lawyer.
Secondly, there is no universal copyright law, in some jurisdictions it’s implicit in some it’s not. So put a notice in the your code to state your intent. Good luck if you actually want to enforce it though – it will be costly.
Trademarking is different you will have to repeat the trademark process in all jurisdictions you want protection. It gets expensive.
If your idea is worth it, and you can afford it, then go through the time, expense and pain.