Ask Question
4 August, 16:30

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.

+4
Answers (1)
  1. 4 August, 17:37
    0
    my_linear_search (arr, SIZE, x);

    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);
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “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; ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers