5. Let $[x]$ denote the greatest integer not exceeding the real number $x$. Then the number of roots of the equation $2^{x}-2[x]-1=0$ is ( ).
(A) 4
(B) 3
(C) 2
(D) 1
5. B.

Notice that, the number of roots of the given equation is equal to the number of intersection points between the graph of the function $y=2^{x}-1$ and the graph of the function $y=2[x]$.

In the same Cartesian coordinate system, draw the graphs of the functions $y=2^{x}-1$ and $y=2[x]$, as shown in Figure 6. The graphs of the two functions have three intersection points.
Therefore, the equation $2^{x}-2[x]-1=0$ has three roots.