231k views
5 votes
Write a function addone that adds 1 to its integer reference parameter. the function returns nothing. submit

User Foolbear
by
7.6k points

1 Answer

3 votes
void addone(int &n) { n++; }

This would do the trick in C++, assuming that's what you're looking for.
User Supahfly
by
9.3k points