Here is Prob. 7, Chap. 6, in the book Principles of Mathematical Analysis by Walter Rudin, 3rd edition:
Suppose $f$ is a real function on $(0, 1]$ and $f \in \mathscr{R}$ on $[c, 1]$ for every $c > 0$. Define $$ \int_0^1 f(x) \ \mathrm{d} x = \lim_{c \to 0} \int_c^1 f(x) \ \mathrm{d} x $$ if this limit exists (and is finite).
(a) If $f \in \mathscr{R}$ on $[0, 1]$, show that this definition of the integral agrees with the old one.
(b) Construct a function $f$ such that the above limit exists, although it fails to exist with $\lvert f \rvert$ in place of $f$.
Here is the link to my post on Prob. 7 (a), Chap. 6, in Baby Rudin:
And, here is the link to a post of mine here on Math SE where I've copied the definition of the Riemann and Riemann-Stieltjes integral that Rudin uses (i.e. Definitions 6.1 and 6.2 in Baby Rudin, 3rd edition):
Here I'll be attempting only Part (b).
My Attempt:
Let $f$ be the function defined on $(0, 1]$ by $$ f(x) = (-1)^n n \ \mbox{ if } \ n \in \mathbb{N} \ \mbox{ and } \ \frac{1}{n+1} < x \leq \frac{1}{n}. \tag{0} $$
If $0 < c \leq 1$, then there is a smallest natural number $N$ such that $$ N \leq \frac{1}{c} < N+1. \tag{1} $$ Then $$ \frac{1}{N+1} < c \leq \frac{1}{N}. \tag{1'} $$
So $$ \begin{align} \int_c^1 f(x) \ \mathrm{d} x &= \int_c^{1/N} f(x) \ \mathrm{d} x + \sum_{k=0}^{N-2} \int_{ 1/(N-k) }^{ 1/(N-k-1) } f(x) \ \mathrm{d} x \\ &= \int_c^{1/N} (-1)^N N \ \mathrm{d} x + \sum_{k=0}^{N-2} \lim_{\varepsilon \to 0+ } \int_{1/(N-k)+\varepsilon}^{ 1/(N-k-1) } (-1)^{N-k-1} (N-k-1) \ \mathrm{d} x \\ & \qquad \mbox{ [ using (0) above and Prob. 3.7(a), Chap. 6, in Baby Rudin ] } \\ &= (-1)^N N \left( \frac{1}{N} - c \right) \\ & \qquad + \sum_{k=0}^{N-2} \lim_{\varepsilon \to 0+ } (-1)^{N-k-1} (N-k-1) \left( \frac{1}{N-k-1} - \frac{1}{N-k} - \varepsilon \right) \\ & \qquad \mbox{ [ using Theorem 6.21 in Baby Rudin ] } \\ &= (-1)^N N \left( \frac{1}{N} - c \right) \\ & \qquad + \sum_{k=0}^{N-2} (-1)^{N-k-1} (N-k-1) \left( \frac{1}{N-k-1} - \frac{1}{N-k} \right) \\ &= (-1)^N (1- cN) + \sum_{k=0}^{N-2} (-1)^{N-k-1} \frac{1}{N-k} \\ &= (-1)^N (1-cN) + \sum_{k=1}^{N-1} (-1)^{N-k} \frac{1}{N-k + 1 } \\ &= (-1)^N (1-cN) + \sum_{r=1}^{N-1} (-1)^r \frac{1}{r+1}. \tag{2} \end{align} $$
Now as $c \to 0+$, then from (1) we can conclude that $N+1 \to \infty$ (through natural numbers), which happens if and only if $N \to \infty$, and so $$ \lim_{N \to \infty} \sum_{r=1}^{N-1} (-1)^r \frac{1}{r+1} = \sum_{r=1}^\infty \frac{(-1)^r}{r+1}, \tag{3} $$ which is a real number, by virtue of Theorem 3.43 in Baby Rudin.
And, $$ \begin{align} \left\lvert (-1)^N (1-cN) \right\rvert &= \left\lvert 1-cN \right\rvert \\ &= 1 - cN \\ &< 1 - \frac{N}{N+1} \\ &= \frac{1}{N+1}. \tag{4} \end{align} $$
Now as $$ \lim_{N \to \infty} \frac{1}{N+1} = 0, $$ so from (4) we can conclude that $$\lim_{c \to 0+} (-1)^N (1-cN) = 0. \tag{5} $$
Thus from (2), (3), and (5) we can conclude that $$ \lim_{c \to 0+} \int_c^1 f(x) \ \mathrm{d} x$$ does exist in $\mathbb{R}$.
On the other hand, from (2) we can also obtain $$ \int_c^1 \lvert f(x) \rvert \ \mathrm{d} x = ( 1- cN) + \sum_{r=1}^{N-1} \frac{1}{r+1}, $$ and so $$ \lim_{c \to 0+} \int_c^1 \lvert f(x) \rvert \ \mathrm{d} x = 0 + \sum_{r=1}^\infty \frac{1}{r+1} = + \infty. $$
Thus the function $f$ defined in (0) above provides a required example.
Is this the kind of example that Rudin requires?
Is what I've done so far correct? If so, then what next? If not, then where have I erred and how to rectify my mistake?