Excerpt from a link:
Definition: The anode of a device is the terminal where current flows in from outside. The cathode of a device is the terminal where current flows out. This is illustrated in figure 1.
Figure 1: Anode and Cathode Currents
As always, electrons flowing in is the same as positive current flowing out, and vice versa.
A widespread misconception is that anode polarity is always positive (+). This is often incorrectly inferred from the correct fact that in all electrochemical devices negatively charged anions move towards the anode (hence their name) and/or positively charged cations move away from it. In fact anode polarity depends on the device type, and sometimes even in which mode it operates, as per the above electric current direction-based universal definition. Consequently, as can be seen from the following examples, in a device which consumes power the anode is positive, and in a device which provides power the anode is negative:
When the current through the device is reversed, the electrodes switch functions, so anode becomes cathode, while cathode becomes anode, as long as the reversed current is applied, with the exception of diodes where electrode naming is always based on the forward current direction.