Tuesday, June 19, 2012

Homework 8: Reference Parameters

1. Write the header for a function  addOne that accepts a single integer reference parameter and returns nothing. Name the parameter  x .

void addOne ( int & x )

2. Write a function  addOne that adds 1 to its integer reference parameter. The function returns nothing. 

void addOne ( int & x ) { x ++ ; }

No comments:

Post a Comment