If you wrote the code, you are the copyright owner. If you are writing the code in a "work for hire" situation, they are the copyright owners. As of 1989, copyright ownership is automatic, and stating it is optional. I believe it is also prudent.
As a copyright owner, you can (according to Wikipedia):
- produce copies or reproductions of the work and to sell those copies (including, typically, electronic copies)
- import or export the work
- create derivative works (works that adapt the original work)
- perform or display the work publicly
- sell or cede these rights to others
- transmit or display by radio or video.
You may license your work to somebody else, and in the license, you can grant any or all of the rights of copyright to the licensee. You can also make these copyright grants free, or conditional upon payment of license fees. Licenses can also be time-limited.
In your case, you want to share. Assuming that there are no patents involved in your work, I would go with:
- the GPLv2 license if you want your code to be forever free to study and improve, and all derivative works to also be free to study and improve. (Programmers and academics usually prefer this one).
- the MIT license if you want anybody to be able to freely use your code, but allow them to keep their derivative works secret. (Commercial software vendors tend to like this one better).
If there are patents involved, the licensee is responsible for also acquiring patent licenses for relevant patents.
If there are patents (which you own) which you also want to freely release with this software, use:
- the GPLv3 license - For the same reasons as GPLv2.
- the Apache 2.0 license - For the same reasons as the MIT license.
In all of these cases you retain copyright ownership, and the code can be shared.