A gambler plays the following coin-tossing game. He can bet an arbitrary positive amount of money. Then a fair coin is tossed, and the gambler wins or loses the amount he bet depending on the outcome. Our gambler, who starts playing with  $ x$ forints, where $ 0<x<2C$, uses the following strategy: if at a given time his capital is $ y<C$, he risks all of it; and if he has $ y>C$, he only bets $ 2C\minus{}y$. If he has exactly $ 2C$ forints, he stops playing. Let $ f(x)$ be the probability that he reaches $ 2C$ (before going bankrupt). Determine the value of $ f(x)$.
1. **Define the problem and the strategy:**
   - The gambler starts with $x$ forints, where $0 < x < 2C$.
   - If the gambler's capital $y$ is less than $C$, he bets all of it.
   - If $y$ is greater than $C$, he bets $2C - y$.
   - The game ends when the gambler reaches $2C$ forints or goes bankrupt.

2. **Define the probability function:**
   - Let $f(x)$ be the probability that the gambler reaches $2C$ forints starting with $x$ forints.

3. **Use the concept of a martingale:**
   - The gambler's fortune $F_t$ is a martingale. This means that the expected value of the gambler's fortune at any time $t$ is equal to his initial fortune $F_0$.
   - By the optional stopping theorem, if $T$ is a stopping time (the time when the gambler either reaches $2C$ or goes bankrupt), then $E(F_T) = F_0$.

4. **Set up the equation using the optional stopping theorem:**
   - Let $p$ be the probability that the gambler reaches $2C$ forints.
   - The expected value of the gambler's fortune at time $T$ is given by:
     \[
     E(F_T) = p \cdot 2C + (1 - p) \cdot 0
     \]
   - Since $E(F_T) = F_0 = x$, we have:
     \[
     x = p \cdot 2C
     \]

5. **Solve for $p$:**
   - Rearrange the equation to solve for $p$:
     \[
     p = \frac{x}{2C}
     \]

6. **Conclusion:**
   - The probability that the gambler reaches $2C$ forints starting with $x$ forints is given by:
     \[
     f(x) = \frac{x}{2C}
     \]

The final answer is $\boxed{\frac{x}{2C}}$