1 2 3 4 5 6 7 8 9 10 11 12

Functions with no arguments
C++
No need to use the word void when declaring or defining a
function with no arguments.
void draw (void);/* no arguments in C */
void draw ();/* variable parameters */
void draw ();// no arguments in C++


Initializing parameters


C++ allows function arguments to have default values. The
following function prints N newline chars, but if no
parameter is passed, then a default of 1 is used.


void new_line (int N = 1)// default argument
{
while (N-- > 0)
putchar ('\n');
}
with invocation:
new_line (3); // prints 3 blank lines
new_line ();// 1 blank line by default


Call by reference parameters.


This is a significant difference.


In C to pass back a result through a parameter you must
provide a pointer to the location where the result is to
go (the pointer itself does not change)thus we write
scanf ("%d", &N);

or looking at the swap function in C we write:

March 2,1998Page 9

C201 TAM/AGS