Function Arguments

I have a couple questions that I am not sure how to answer for a review before my midterm.

What kind of argument can you pass to a function in the place of an array parameter of base type double?

Identify all types of argument that you can pass to a function in the place of a call-by-value parameter of data type int?

I believe the type of argument you can pass in case of the former would be:
double function1( double arr1, double arr2)

Not sure about the ladder.

Thanks
Awesome thanks for the help. I understand the answer to the 2nd question which I believe call by value parameters will be int, char and double.

I guess I am having a hard time understanding what the first question is asking. I actually fill as if I am a bit more confused after reading about functions and arrays. I don't know if I am supposed to be discovering an argument that replaces arrays or an argument that is used for an array.

The questions just doesn't sound quite right in my head and maybe my understanding of functions and arrays isn't as well as I thought which is more of my problem rather then the question.

Could you please elaborate a bit more. From what I believe the question is asking should I be writing:

double printArray (double arg[], int blah);

Thanks for the links helped a lot for my 2nd quesiton.
Actually, both questions might be about what can be comverted into the type of a function parameter.

http://stackoverflow.com/questions/5573310/difference-between-passing-array-and-array-pointer-into-function-in-c
http://www.cplusplus.com/doc/tutorial/typecasting/


Here is an example that has an error:
void foo( int );

int main() {
std::string bar;
foo( bar ); // error: conversion from type std::string into type int is not possible (implicitly)
}
After reading more I just don't get the answer for either. It makes no since to me. Even after reading the resources you gave I am just not understanding the question nor am I understanding how its answered.
After reading another resource I understand it now. for the first fcn (double x, double y) would work to replace an array parameter.

For the 2nd void fcn (int& x, const int& y) can be used to replace call by value of type int.
Topic archived. No new replies allowed.