 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can calculate sum of array by passing array into function using pointer. 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 Techimace which is available on Google Play. Now I am going to implement the solution of this problem. So I will be passing an array into function and that array will be received through a pointer in the function definition. First of all, I am including a header file that is a stdio.h. Now I am declaring a function. So here name of function is sum, its return type is integer and it will it will receive an address of integer variable. So I will be passing address of array and that address will be received through a pointer. So this statement is function declaration. Now I am defining main function. So inside main, first time declaring an array variable i and s. Now with the help of printf the masses enter 10 elements will be displayed on console. To receive those elements I am applying for loop which will receive the elements through this scanf statement. Now I have to call the function sum. So this statement is function call. Here you can see I have passed the name of array. So name of any array provides base address of that array. So in this function call base address of this array a will be passed automatically and the result will be returned into this s variable. So after completion of function definition the result will be stored inside s variable. So I can print that sum on console with the help of this printf statement. Now return 0. So this is the definition of main. Now I have to define some function definition. So this block is function definition inside this function. I have to implement the logic where I will be adding all the elements of array using this pointer P. So P pointer is having base address of array. So here I am implementing two variables i and s. Now I am applying a loop which will repeat 10 times. Inside this loop I have to implement the logic which will add the elements of array through pointer. So I am writing this s equals to s plus asterisk P. So here asterisk means value at address. So P is containing an address. So to find out value which is available on that address I have to use this asterisk sign. So it denotes dereferencing. So after dereferencing this P pointer will be providing a value that will be added inside s variable. Now I want to move to the next location of array. For that purpose I am applying P plus plus. So pointer is incremented here. So this pointer will be pointing to the next location of array. So this process will take place 10 times. After completion of this process result will be available inside s variable. So I am returning s so that it can be received at function calling statement and the result can be displayed on console. So this way I have implemented in front of you how we can add all the elements of array with help of pointer and I have passed array into function. Now I am going to execute this code. Sorry by mistake I have type wrong character in this statement. Again I am executing this code. You can see it is asking for 10 elements. So I am entering one in each location. Output is sum equals to 10. So the program is working properly. All the locations are added with the help of this pointer and the result is stored inside s variable. I hope you have understood how I have passed array into function and that array is received in function definition through a pointer. 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 tech image which is available on google play. Thank you for watching this video.