asked 84.5k views
22 votes
Conside following prototype of a function

int minArray(int [], int );
Which of the option is correct way of function CALL assuming following arraydeclaration
int x[5] = {7,4,6,2,3};*
a) minArray(x,5);
b) minArray(x[],10);
c) minArray(x[5],5);
d) minArray(5,x);

asked
User Jferard
by
8.3k points

1 Answer

7 votes

Answer:

The answer is "Option a"

Step-by-step explanation:

Following are the code to this question:

#include <stdio.h>//header file

int minArray(int x[], int n)//defining method minArray that accepts two parameters

{

for(int i=0;i<n;i++)//defining loop for print value

{

printf("%d\\",x[i]);//printf array value

}

}

int main()//defining main method

{

int x[] ={7,4,6,2,3};//defining array that hold values

int n=5;//defining integer variable

minArray(x,5);//calling method minArray

return 0;

}

In this code, a method "minArray" is defined, that accepts two parameters array and an integer variable in its parameter, and in the next step, the for loop is declared, that uses the print method to prints its value.

In the next step, the main method is declared, which declared an array and holds its values and defines an integer variables, and calls the method "minArray".

answered
User Sonatique
by
8.5k points

Related questions

2 answers
3 votes
226k views
1 answer
2 votes
168k views
asked Feb 17, 2020 129k views
Jeremy T asked Feb 17, 2020
by Jeremy T
7.7k points
1 answer
3 votes
129k views
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.