@BalarkaSen I want your comment on the example I had in mind. (Ted said it doesn't work), but I don't understand why.
"
For each interval in the x-axis like [1/n, 1/(n+1)], I define my curve as a semi-circle (drawn above the x-axis) with the diameter equal to the length of the interval. The semi-circles keep shrinking up to zero. At the endpoints (where x = 1/n) the curve has cusps, but I think it is also smooth there (not sure about that) because it is where the two tangent semicircles meet.