Practice. Mike Acton from Insomniac games brought this up during a talk at a conference. Get in the habit of opening up an editor, writing a linked-list, hashtable, or some other small program, then 30 minutes later, close the file without saving.
Do it again the next day, and again, and again, and again.. Then move onto another small program... Keep doing this. Acton stated that many programmers forget that you can actually practice coding like a musical instrument in a repetitive and methodical fashion. This single realization has done wonders for me in retention of skills.