 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can calculate some of even and odd elements entered by the user through dynamic memory location using malloc, calloc and free functions. Before starting, you can note my information. You can connect with me by following these details which are available in front of you. Don't forget to download my programming app Techmiz which is available on Google Play. You can search my YouTube channel by typing my name in YouTube search bar that is Sanjay Gupta. My channel will be available there. You can open it. Here you will be finding various programming related playlist where programming related videos are available. You can improve your programming skills by watching these videos. Don't forget to subscribe my YouTube channel by clicking on this button. If you want to, now if you want to understand how I am going to implement this code. So watch this video till it ends. So first I am including header file stdi.h. Then I am including another header file that is stdlib.h. Now in main function, I am declaring a pointer variable n i s1 which is initialized with 0, s2 which is also initialized with 0. Then with the help of printer the message enter size will be displayed. So this message means how many values user want to enter. So that size will be stored inside n through scanf. Now I have to create memory blocks as per n. So I am using malloc function for that purpose. So this statement will allocate dynamic memory. Here n into size of n will be passed as an argument. So n means number of blocks and size of int means memory size of each block. So malloc will be creating that required size and its return type is integer pointer. So the address which will be returned through malloc will be typecasted into integer pointer and that will be stored inside p pointer. Now I have to receive elements from user after memory location. So I can print this message on console. Now with the help of for loop I am going to receive those elements from user. So for that purpose I am writing scanf statement and here I am writing p plus i. So p is having base address and I am adding i into it so that I can reach to different different locations of that memory. So the entered element will be stored at different memory addresses through this scanf. Now inside this loop I can apply if because I have to check whether the entered number is even or odd. So for that purpose I am using this notation as p plus i modulus 2 double equals to 0. So the element which is entered through user is available in p plus i address. I have dereferenced it with asterisk sign. So if it if it is divisible by 2 then it is even. So I can write s1 equals to s1 plus asterisk p plus i. So this way that element will be added into s1 otherwise it will be added into s2. So this way even and odd elements are added into s1 and s2 respectively. Now after completion of this loop I can print the result on console. So even equals to percent d odd equals to percent d then s1 comma s2. After this printing I can free the allocated memory space through a free function call. So it deallocates dynamically allocated memory and at last I can write return 0. So this way I have implemented the complete code in front of you using dynamic memory location. So it will read n numbers from user and those numbers which are even will be added into s1 and those numbers which are odd will be added into s2 and whole operation is implemented using dynamic memory location. So right now I have demonstrated you malloc. After execution I will be converting this malloc into calloc function. So I am executing this code. I am entering 6 as size. So I have to enter 6 elements. So I am entering 6 elements 1, 2, 3, 4, 5, 6. So you have to add 1, 3 and 5. So 5, 3, 8 plus 1, 9. So odd sum is 9 and even elements are 2, 4, 6. So their sum is 12. So this way program is working properly. Now I can convert malloc into calloc by applying this change. So malloc is replaced with calloc and multiplication is replaced with comma because calloc receives 2 arguments. Now again I am executing this code. I am entering 6 as size and I am entering 6 elements. You can see again it is showing same result on console. So this way I have implemented the concept in front of you using malloc, calloc and free functions which is calculating sum of even and odd elements entered by user. So I hope you have understood how I have implemented this code in front of you. 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 techiness which is available on google play. Thank you for watching this video.