Obviously something as simple as
int i = 0; or
for (int i = 0; i < 10; i++) can't be copyrighted, but an entire function could be. Where is the line between copyrightable and uncopyrightable?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
In order to be copyrighted, a something must be an original work of authorship fixed in a tangible medium of expression. See 17 USC 102. The originality requirement is going to be key when talking about code. Your code must do something. I'm not sure that the courts have ever decided this particular question, but basic algorithms are not likely to suffice. You need a program of some sort that does something meaningful.
IBM copyrighted a mainframe program called IEFBR14 which was originally 1 machine language instruction. Amusingly this program would have the highest defect per LOC ever. Wikipedia has a more detailed description.