Can You Contribute to Charity Through Your 401k or IRA?

Typically people withdrawing money from an IRA or 401(k) have to count it as taxable income (except for, say, a Roth IRA). I wonder if there is some way for people to make charitable contributions from an IRA (or 401(k), ) that does NOT count as taxable income. It would make it easier for retired people to contribute to a charity. I want to hear from CPAs, accountants, and other financial experts from Long Island and the New York City metro are. Is this correct? Any way to contribute to charity through a 40lk or IRA? If so, what are the rule, what do people need to know and understand, any mistakes to avoid?