Yes, source code can be and usually is copyrighted. For an explanation
of how copyright works, I can highly recommend the following site,
which provides a good overview of copyright (without specifying a
particular country's legal system):
There have been some arguments that source code is not a creative
work, and thus should not be copyrightable. So far, this view has not
(to my knowledge) been agreed with by the courts. For a summary of the
argument, however, see this article:
I hope this helps. If anything's unclear, please don't hesitate to
request clarification before rating this answer.
"source code" copyright
"what is copyright"