No, the literal source code you write is protected automatically by copyright, not patent; a patent instead protects the underlying novel technical process or method the code implements. The two protections work together: copyright stops someone copying your code, a patent stops someone implementing the same process in different code.
We use essential cookies to make our site work. 🍪 With your consent, we may also use non-essential cookies to improve user experience and analyze website traffic. By clicking “Accept,” you agree to our website's cookie use as described in our Cookie Policy. You can change your cookie settings at any time by clicking “Preferences.”