Step 1: Look at one carbon:
In $\text{HOOC-COOH}$ each carbon has one C=O bond (counts as $+2$ for C), one C-OH bond (O is more electronegative so $+1$ for C), and one C-C bond (same atoms, contributes $0$).
Step 2: Add up:
$+2 + 1 + 0 = +3$.
Step 3: Cross-check with the formula:
$\text{H}_2\text{C}_2\text{O}_4$: $2(+1) + 2x + 4(-2) = 0$ gives $x = +3$.
Both routes agree. A value of +4 would need the carbon to be in $\text{CO}_2$, and +2 is typical of CO.
Final Answer:
Oxidation number of carbon is $+3$, option (B).
\[ \boxed{+3 \text{ (B)}} \]