Ask 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; assume that all variables are declared and initialized.

+4
Answers (1)
  1. 13 April, 23:52
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers