$f(x)=\left\{ \begin{aligned} \cos(x)\quad x \ne 0\\ 0 \quad x=0\\ \end{aligned} \right.$ is discontinuous but differentiable at $0$? According to wikipedia :

A function is said to be continuously differentiable if its derivative is also a continuous function;

I thought of the discontinuous function  :
$f(x)=\left\{
\begin{aligned}
\cos(x)\quad  x \ne 0\\
0 \quad x=0\\
\end{aligned}
\right.$
which doesn't exist for $x=0$ and is discontinuous .
it's derivative is :
$f'(x)=\left\{
\begin{aligned}
-\sin(x)\quad  x \ne 0\\
0 \quad x=0\\
\end{aligned}
\right.$
which exists for $x=0$ and is continuous .
Am I doing something wrong ? if not were my assumptions true that discontinuous function can have continuous derivatives ?
 A: You claim that $f'(0)=0$ but that's not true since you cannot derive the function in a discontinuity point, so your derivative only exists in $\mathbb{R}-\{0\}$
A: Hint: $f$ is differentiable at $a$ implies $f$ is continuous at $a$.Contrapositively $f$ is not continuous at $a$ implies $f$ is not differentiable at $a$ .

$\lim_{x\to 0} f(x) =\lim_{x\to 0} \cos x=1\neq  0$
Hence given function $f$ is not continuous at $0$ , we can't talk about $f'(0) $
A: As other answers point out, your question is flawed because, according to the definitions, $f'(0)$ does not exist. This answer might not be totally satisfying to you though, and I think there is a more interesting question remaining after you fix your terminology.
Now; the derivative $f'(x)=-\textrm{sin}(x)$ is obviously defined everywhere except 0, and moreover, has an obvious extension to say $f'(0)=0$ which makes the whole derivative continuous on the real line.
That is to say, your derivative has a removable discontinuity(*) at zero, and it's trivial to repair it into a total continuous function. So your function "might as well be" continuously differentiable.
That being said, your function also "might as well be" everywhere continuous -- the discontinuity is removable.
So a more interesting version of your question is -- is there a discontinuous function f, which is really discontinuous (not just a removable discontinuity or two) whose derivative might as well be everywhere continuous?
The answer is actually yes! And it's not hard to construct it: let $f(x)=0$ when $x<0$, and let $f(x)=1$ when $x>0$. It doesn't matter what $f(0)$ is, do what you want.
Now there is no way to make that continuous. But the derivative $f'(x)=0$ is defined everywhere except zero, so it "might as well be" continuous everywhere. And there you go! You have a function that's really not continuous but that "might as well" be continuously differentiable everywhere. Fun!
This function is called the Heaviside function, and it looks like a step (I hope you can imagine it). You can obviously extend this example and make lots more steps, and make your function have lots of (real) discontinuities -- infinitely many if you want to -- and still have $f'$ be "essentially" continuous everywhere.
(*) Technically it's not a discontinuity at all; the function isn't discontinuous at zero because it's not defined at zero. But you could trivially extend the function to be defined at zero in a way that's continuous. I don't know a common term for this situation but I hope the spirit of this is obvious.
A: That function is not continuous at the point $x=0$, so $f$ is not differentiable at that point. Hence your claim $f’(0)=0$ doesn’t make sense.
Remember, if a function is not continuous, its derivative doesn’t exists (in other words, a derivable function MUST be continuous).
