Vidyalelo
C Programming · Q48

Arrays and Strings

Programming · C Programming · question 48

Q48

Which of the following is correct way to define the function fun() in the below program? #include void main() int a[3][4]; fun(a);

A.
void fun(int p[][4]){}
Answer
B.
void fun(int *p[4]){}
C.
void fun(int *p[][4]){}
D.
void fun(int *p[3][4]){}
E.
None of these

Answer: Option A

Solution

Answer: Option A
Solution:

void fun(int p[][4]){ } is the correct way to write the function fun(). while the others are considered only the function fun() is called by using call by reference.