Ask Question
4 February, 07:38

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.

+2
Answers (1)
  1. 4 February, 11:22
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers