I was wondering what requirements must be met if you want to License Code, if you take this Simple Code for example:

int main()
    int x = 0;
    return 0;

Could one Hypothetically License this 5 simple Lines of Code? If not why?

  • See also: License for code snippets?
    – Brandin
    Jan 11, 2019 at 7:34
  • For something to be copyrightable it has to include creative elements. I see no creative elements in your program. For example, every C program must have the line "int main()" somewhere and returning 0 is pretty standard. Finally, you make an assignment to x but never use it for some reason. As you add creative input to this, it will become more likely to be copyrightable.
    – Brandin
    Jan 11, 2019 at 7:42
  • @Brandin My C programs have int main(void) or int main(int argc, char **argv) or similar. int main() is either bad C, old C or C++. Jan 11, 2019 at 7:50
  • "For something to be copyrightable it has to include creative elements." Is this written somewhere? If so where is the Line between non Creative and Creative Elements drawn? And who decides that? The Judge? And of course this Program was just an Example and doesnt do Anything. Thanks for your Time :)
    – ZoidZero
    Jan 11, 2019 at 12:08
  • @ZoidZero In the US, something copyrightable has to include creative elements. I don't know about other countries. One result is that a photograph intended to look as much as possible like the original painting can't be copyrighted in the US, as creativity is excluded from the process as much as possible. For more questions, try law.stackexchange.com. Jan 11, 2019 at 17:51

1 Answer 1


You can always put a license on it, just like anything else, but it's probably too trivial to be copyrightable. But the only way to know for sure would be for it to be tested in court.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.