Because this line:
adds root->worth (100) to the previous value of totalIncome. Since the previous value of totalIncome was "uninitialized garbage", the value of totalIncome afterwards is "100 more than uninitialized garbage".Code:totalIncome = root->worth + totalIncome;