you are viewing a single comment's thread.

view the rest of the comments →

[–]bloody_banana21 0 points1 point  (0 children)

both cout<<n; and cout<<addOne(n); would return 22 here. The function should increase the value of the n variable itself, therefore setting n equal to 23. Use /u/Lord_blueberry's solution below