CC0 can be used for source code. For example, the FSF lists it as a GPL-compatible free software license and states: "If you want to release your work to the public domain, we recommend you use CC0."
https://www.gnu.org/licenses/license-list.en.html#CC0
Creative Commons themselves have published a FAQ entry on the matter:
https://wiki.creativecommons.org/wiki/CC0_FAQ#May_I_apply_CC...