145k views
3 votes
What is the correct way to call function: int my_linear_search(int a[], int size, int key); to search value x in array arr with size SIZE; assume that all variables are declared and initialized.

User Brunilda
by
4.9k points

1 Answer

3 votes

Answer:

my_linear_search(arr, SIZE, x);

Step-by-step explanation:

When we define the function, the program control moves to the function define only if when that function called.

In the define function, we provide the return type to function and the type to parameters but in the calling function, we do not provide any return type and also not mention the type of variable pass in the call function.

Syntax of the calling function:

name(argument_1,argument_2,so on....);

the name must be the same as the define function and in the argument, we can pass the variable or direct value as well.

In the question:

The function is int my_linear_search(int a[], int size, int key)

so, in the calling function name will be the same and we pass the name of the array, size of the array, and then search value.

my_linear_search(arr, SIZE, x);

User Lee Berger
by
5.9k points