Arrays

Gapfill exercise

  
Enter your answers in the gaps. When you have entered all the answers, click on the "Check" button.
What do you mean by passing an array to a function?
Generally we pass values and while a function, likewise we can also arrays to a . You can pass array’s as well as whole array (by just specifying the array name, which works as a pointer) to a .

What is pointer to array?
Array elements can be and manipulated using pointers in C. Using you can easily handle . You can have access of all the of an array just by assigning the array’s base address to variable.

How to store user input data into 2D array
We can calculate how many elements a two array can have by using this formula:
The arr[n1][n2] can have n1*n2 elements. The that we have in the example below is having the 5 and 4. These dimensions are known as . So this has first subscript value as 5 and subscript value as 4.
So the abc[5][4] can have 5*4 = 20 elements.

How to pass an entire array to a function as an argument?
In the above example, we have the of each array element one by one using a for in C. However you can also pass an entire array to a like this:
Note: The name itself is the of first element of that . For example if array name is arr then you can say that arr is equivalent to the &arr[0].

What do you mean by Passing array to function using call by reference?
When we pass the of an array while calling a then this is called function call by . When we pass an as an argument, the function should have a pointer as a to receive the passed .