Continuous function almost everywhere

Definition. A function is called continuous almost everywhere if it is continuous at all points expect at points which constitute a set of measure zero.

Following are two nice examples which illustrate the definition and a possible misinterpretations.

Define a function f:\mathbb{R}\rightarrow \mathbb{R} by

f(x)=1,\quad x\in \mathbb{Q} f(x)=0,\quad x\in \mathbb{Q}^c.

Note that f is discontinuous at all points in \mathbb{R}.

Define a function f:\mathbb{R}\rightarrow \mathbb{R} by

f(x)=\frac{1}{n},\quad x=\frac{m}{n}\in \mathbb{Q} f(x)=0,\quad x\in \mathbb{Q}^c.

Note that f is continuous at all irrational points. It is however discontinuous at all rational points. But, as rational points in \mathbb{R} is a set of measure zero, the function f is continuous almost everywhere.