 Hello friends, I am Sanjay Gupta. Welcome back on Sanjay Gupta Tech School. So, you can see language video series and this video series is lecture number 30. This is the third part of the function and I will tell you how to pass an array string or structure in the function. So, we will discuss these three by doing this. So, I will tell you how to pass an array string or structure without using pointer. So, I will tell you both. This is going to be a very important video for you. And I hope that before watching this video, you must have seen the lecture number 29 and the lecture number 28. So, I covered the basics in the 28 and in the 29, I told you about the function a little more in advance. And if you have any doubt related to functions or any topic, then this is my detail which you can use to communicate with me. And you will find the playlist link of this video in the description of this video. So, you can follow the whole series from there. So, let's start. The first program is called how to pass an array with or without pointer into function. So, first we will pass an array into function without using pointer and then we will convert the same program using pointer. So, it is very simple because you are familiar with the function. So, you will be able to understand this easily. So, passing array into function. So, first let's include the header file. After including the header file, we have to declare the function. So, now we have to pass an array. So, basically we will pass an array. And we have to calculate the sum of all the elements available in it. So, remember that whenever you have to pass an array, you have to use this declaration. The function name will come. If you have to pass an array, the type of array is data type and square brackets. If you have to pass an array, you have to write it once. If you have more than one array, you have to pass it twice, three times, four times. The type of array you have to pass, you can mention data type and square bracket. So, square bracket tells you that the argument you will pass will be basically an array. So, we have to pass an array. So, we have to write int square bracket once. And total sum we have to return. And it will become a single value. So, the return type is int. Main function. In the main function, we have to declare an array. Variable i or s. I have written printf, enter values. To read them, we have to write a scanf for loop. In which we will repeat scanf. So, the size of the array is the same as the loop we have run. So, we have to input all the elements from the user. Now, after reading the values from the user, we have to call the function. So, you have to write this. This is calling of function. So, we have called some function. We have passed an argument as an array. And the total sum we will return will be stored in the variable s. So, to print some, I have to display the s variable. So, you can see in the main function, the logic of sum is not written anywhere. We have to define it separately after the main function is finished. And what I have written above, it is declaration. Which I have already told you in the previous two videos, how we create it. Now, we will write int sum, int a and square. So, whenever you write the definition of the function, you have to write the data type and the variable. Now, we have to write the variable array type, square bracket b. Then, i and s. Then, you run the loop. i equals to 0. i less than 10. i plus plus. And what you can do through the loop? s equals to s plus a of n. So, this loop will sum all the elements available in the array. After the loop is finished, the total will come in the variable s. So, what will you write? return s. So, from here, s will return its value, wherever this function is called. So, in this way, I passed the array to the function. I added it to the function. And the final outcome that came out, I returned it to the main function again. And this whole block, we will call it definition. So, in this way, you can pass the array to the function and process it. So, I have explained the array programs in the previous videos. You can convert them. If you ever have any doubt, then my details are available to you. You can terminicate it. So, I have inputted 10 numbers. And what is the sum that came out? 10. Okay. Now, the benefit of the function is that we have written the definition of the sum function. Now, you have one more array. So, you do not have to write the logic of the sum function. You simply have to call it so that you can calculate the sum of the other arrays. So, how do we reuse the function? So, I have explained that in lecture number 28. Look, in 28, I have told you that how we can call one function more than once. Okay. So, in this video, you must have seen that. So, you can apply that thing here also. So, now we have seen how to pass the array without pointer. Now, we will see how to use pointer. Sometimes, such a requirement comes that you want to process the array through pointer and through function. So, in that case, what we will do? Here, you will have to use integer pointer. Main function as it is, because when we pass the array, I have already told you that the name of the array denotes its base address. I have told you in the array and pointer that the name of the array represents base address, beginning address. So, when we are passing the name of the array from the calling, it passes its base address. So, you have to receive it in the pointer here. Then, we have run the loop 10 times. And what we have written in this loop? I have written this AO5 as asterisk p and p++. Okay. Now, you can see that in the calculation, I have not used the array anywhere. I have passed the base address of the main function of the 11th line from there, which was received in the pointer from the array. So, how does the array and pointer work? For that, you will have to see the video which I have made for the array and pointer. So, the entire video series that you are following you must have understood this. If you want to learn the array and pointer, then I will tell you which lecture number it will be. Look at this. I had told you in lecture number 23 how to use the array and pointer. So, you will understand that when you see it. So, the first topic has been covered that how to pass the array in the function without the pointer or the pointer. Now, we are going to use the same approach for the string. So, it will be very easy to understand the string. First, I will run it and tell you whether it will work properly or not. See, I am entering 10 values again and what is the sum? So, you can pass the array in the function without the pointer and using the pointer in both the ways. Now, we will pass the string. So, we have to use the characters in the string. So, we will pass a character in the string function and we will get the length of the character in which it will be available. Now, the name of the function will be length. Here, I have written character str size 10. Here, I have written getters str and I have done this. In the string, in the length in which it will be available, l equals to length of str. This function has been called. And to print the length, length equals to percent of l. See, we have modified the main function. So, you know how to read the string. You have come to call the function. So, you can write the definition easily. So, what you have to do? Character str. Now, you can see that as the integer array is being processed, the character array is also being processed. So, the loop of this is different. Because we don't know how many characters are there. So, we run the str of i till null. So, I have already told this in the string video. So, I request you to follow the entire video series. If there is no topic, you can understand it. So, if there is a topic related to it, you will understand it well. So, I have modified this. See, I have passed the string, from line number 11 as an argument. And this was the definition in which I have received the string. And after that, I have applied this calculation. So, now, if we execute this. And I have entered my name. See, what is the length? Six. And I hope that you can easily convert this into a pointer. So, this is the new character pointer. Main function will remain the same. Here, it will be pointer p. Here, we will write pointer p. Because we have to extract value from p. And we will add p to plus. So, where we have used the array, we have used the pointer. So, if you look at this code, it will not show you the string, character array. Only the pointer is used. And if we execute this. See, I have entered the length. Six. So, in this way, you can pass the string without pointer or using pointer in both ways. Next, you see, pass structure using or without using pointer into function. So, this is also going to be very simple. Because you have already read the structure. I understand this. If you have not read it, then read it first so that you can get familiar with the structure. We will not return anything from the structure. We will just print it. So, I have written the name of the function. Display. So, first, I will pass a structure variable. So, I am writing struct-student. So, as I have to pass an integer, then I will just write int. Now, I have to pass a structure type variable. So, I have written struct-student. Now, let's erase all the other things. So, here I have written struct-student s. Then, I have written printf enter roll number name and marks. Then, I have scanned. First, I have scanned roll number. So, %d m% s.roll number. Then, I have to read the name. And then, I have to read the marks. Okay. Now, we will have to make a character variable more. So, whenever I tell the structure, then I create it and I use it to bypass the enter. Okay. This will be erased. I will erase it completely from the beginning. So, in the main function, we have got input from the user. Everything is available in s variable. Now, I have to display it. Means, the input that the user has made is to be displayed. But, I have to display in the main function. So, see the written type of the display function is void. So, I have not used any variable here. s. I had to pass here. So, I have used the data type here. Struct student. Okay. Because the structure type is a variable. Now, I have to define the display function. So, I have to define the display function. So, I have to define the display function. So, if we are accessing the member, we will put a dot. But, when I will convert it through point tricot, I will change it a little bit. So, that thing will be important for you. So, you will understand how we process the structure through the function. So, see the structure variable has passed through the function. This is the calling. And we have defined the function. So, this is the definition. यहाँ से पास होगर इस एस वेरिबल में आई और उनको आम ने दिस्पलेगरा. तो जो भी इनफुट में फुँशन में रिसी वोगा वो दिस्पलेग फुशन के तुए श्क्रींग पर प्रप्रेंग़. में फुशन के तुए नहीं. तब इस को सेव करके एख्टिकृत करा दिताओं तब दिख़ो रोल नमबर 101, NAME SANJAE & MAGS 1000. तब दिख़ोगे की सारी न्प्मशिन आज़ेट सच्भ्रिंत जो रोल नमबर 101, NAME SANJAE & MAGS 1000. तो यस प्री के से आप श्ट्भ्छर वेरिबल को भी पास पर वासते है. ख़ुद और ख़ुग उément same video अस microscope ब्तितर च्प्टर्त्सिball और वोग sheep आम दो दोल सब और ये वो आद personally उ akkor पficiente बाद � aesthetic मैंbound तो जिनको भी कोई दाूत है, वो मुस्ते कमिल्गेट कर सकते है, और इस पूरी भीटीो सीरिस का जो प्लेलिस लिंक है, वो वीटीो के देस्क्रष्ट्यन राख को में जाएगा. आई होग की जो भी मेंने अप्वर्ट्स की है स्पूरी भीटीो सीरिस को बनाने के लिए वाद के लिए आपके लिए रहे हूँँँँँँ. तो ख़ाएगे प्वर्ट्चन गे स्विडियो.