 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can pass a 2D array into a function. Before starting, you can note my information, you can follow or subscribe my YouTube channel through the URL youtube.com slash sanjaygupta underscore tech school. You can download my programming app Techimus which is available on Google Play. Now, I am going to implement a code in C which will demonstrate you how you can pass a 2D array into a function. So first time including a header file stdio.h then I have to declare a function. Here I am providing function declaration whose written type is void. Name of function is print and it will receive an argument of integer type that will be 2D array. In case of 2D array, you have you also have to provide its dimension like I will be passing 3 by 3 2D array into the function. So this dimension is optional in case of 1D array but whenever you want to pass a 2D array into a function then it is compulsory. Then main function. Inside main I am declaring a 2D array then two variables imj. Now with the help of printer the message enter elements will be displayed on console. To receive elements I am applying for loop. Inside this for loop I am implementing another for loop. So first for loop which is managed by I will be providing row indexes and j will be providing column indexes. Now inside this loop I am going to receive values from user. So for that purpose I have implemented scanf which will receive the elements from user. So this is the reading process. After this reading process I have to call the function where I am passing a as argument. So this one is function calling. So in this function calling I have passed a 2D array that is a then return 0. So this is the complete definition of main function. After this definition I have to define print function. So here I have implemented this block which will be known as function definition. So here you can see I have also mentioned dimension of 2D array. So in case of 2D array this dimension is compulsion. In case of 1D array it is optional. Now two more variables imj are declared. Now I have to print the matrix on console. So for that purpose I have to implement nested loops similar to reading. So this is first for loop. Inside this I am implementing another for loop which will also repeat three times. So I will be providing row indexes and j will be providing column indexes. Now inside j loop I am using printf force and d then spaces and then a of ij. After completion of j loop I am applying printf fashion because I want to print a 2D array in matrix format. So as j loop will be completing it will print first row. So after that new line will be printed so that each row will be printed next line. So this is the complete implementation where I have passed 2D array into a function. Now I am going to execute this program. You can see it is asking for elements. So I am entering elements. Now you can see the output the entered values are displayed on console. So with the help of this simple example I hope you have understood how we can pass a 2D array into a function. If you want to watch more programming related videos you can follow or subscribe my youtube channel through the url youtube.com slash sanjay gupta underscore tech school. You can download my programming app TechMS which is available on google play. Thank you for watching this video.