paramaters by addy

paramaters by addy - In the function call>> an& is...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
> > When the function is to change the value of more than one item, we use > > pass by address: > > Let.s say we are to write a function to calculate the sum and average of 3 > > numbers. We need to pass sum or average or both by address. > > > > We have a program, which calls two functions, the first one is to > > calculate the sum and average of three integers, and the second is to > > print the three values and their sum and average.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: In the function call, > > an & is placed in front of each variable. > > > > We are passing the address of these variables into the function and any > > changes made in the function are also made in the main. > > > > > > When passing a variable by address an * is placed in front of the variable > > name in the function header, function prototype and the body of the > > program....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online