-
September 25th, 2012, 07:19 PM
#1
passing a function parameter by reference
Hello, I created the following code to pass the the variable 'inputVoltage' by reference to the function 'input'. It certainly works when I run the program, but I dont think it is a standard way of doing it, i.e. the use of '*' and '&' is not according to convention ?
Or perhaps the way did it is acceptable ?
Thanks for any confirmation either way.
int input (double *inputVoltage);
int main ( {
double inputVoltage;
input(&inputVoltage);
return 0;
}
int input(double* inputVoltage)
{
cin >> *inputVoltage;
etc.
etc.
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|