Works are in the public domain if they are not covered by intellectual property rights at all, if the intellectual property rights have expired, and/or if the intellectual property rights are forfeited or unclaimed.
For the sake of being absolutely clear about one’s intentions, it is preferable to choose an actual license for distributing source code. If you want to make code available for any purpose whatsoever, a simple license such as the BSD license or MIT license is sufficient. These licenses also have the benefit of specifically disclaiming any warranties and explicitly states that the code is being distributed “AS IS.” The BSD license additionally prohibits the name of the author being used without permission to promote derivative products.
Note that works by the United States government cannot be protected under copyright law and are automatically in the public domain.