An individual array element which is a simple data type can be passed as an argument to a function? is this true or false? explain your answer please.
Printable View
An individual array element which is a simple data type can be passed as an argument to a function? is this true or false? explain your answer please.
True.
int Foo(int i) return i;
int A[3] = {13, 69, 7};
cout << Foo(A[0]) << endl;
An array element can also be passed by storing that particular element located at that index into the varaiable of same data type as array have and then pass that variable as argument.
int Array[5]={0,1,2,3,4};
int variable = Array[1];
now variable has a value "1" in it.
So pass the "variable " as an argument in any function.
True,
Code:void display(const int data) {
printf("%d", data)
}
int main() {
int array[] = {1, 2, 3, 4};
display(array[3]); // answer will be 4
return 0;
}