 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can add heights of two persons using structure and pointer in C programming. Before starting, you can note how you can search my YouTube channel. You can type my name Sanjay Gupta in YouTube search. My channel will be available there. You can watch various programming related videos there. Now I am going to implement solution of this problem. So first I am including a header file that is a cdio.h. Now I am declaring a structure whose name is height. Inside this structure, I am declaring two variables of integer type, feet and inch. And then I have terminated this structure declaration. Now I am defining its variable inside main function. So struct height h1, h2 and h3. These three are variables of structure data type. And I am declaring three pointers as well, p1, p2 and p3. So I am going to access values of h1, h2, h3 variables through these p1, p2, p3 pointers. So first I am going to receive input from user. So the masses enter first height will be displayed on output screen. To read that input, I am writing scanf statement h1.feet and m% h1.inch. So this way height of first person will be stored inside h1 variable. Now after reading height of first person, I am going to display the masses, enter second height. Again to receive height from user, I am writing scanf statement and statements are h2.feet and h2.inch. So this way I have successfully received feet and inches of first height and feet and inches of second height. Now I am going to assign addresses of these structure variables into pointer. So address of h1 is assigned into p1 pointer, p2 will be receiving address of h2 and p3 will be receiving address of h3. Now through this p1, p2, p3 pointers, I can access the locations of h1, h2 and h3 structure variables. So for addition purpose, I am using p3 arrow.feet equals to p1 arrow.feet plus p2 arrow.feet. So here you have to notice that whenever we want to access members of structure through pointer, then we have to use this arrow notation. And if we access structure members through its normal variable that is not a pointer, then we can use this dot operator. So for addition of inches, I have to write this notation p3 arrow.inch equals to p1 arrow.inch plus p2 arrow.inch. So this way I have added feet and inches of h1 and h2 variables through p1, p2 pointer and result is stored inside s3 variable through p3 pointer. Now I have to convert inches into feet because after addition inches might be greater than or equals to 12. So I can convert those inches into feet. So for that purpose, I am going to apply if statement. Now I am writing s3.inch is greater than equals to 12. So notice that I am using s3.inch whereas I have performed addition through p3 pointer. So p3 pointer will modify s3 automatically because it is having its address. Now I can write s3.feet plus plus and s3.inch equals to s3.inch minus 12. So inches are subtracted by 12 and feet is incremented by 1. Now after this process, I can print the result in terms of feet and inches on output screen through s3.feet and s3.inch and at last returns 0. So this way feet and inches are displayed on output screen and I have added feet and inches of two heights through pointers. So now I am going to execute this code so that you can verify whether it is working properly or not. So it is asking for first height. I am entering 5 feet 6 inch. It is asking for second height. I am entering 5 feet 8 inch. So you can see the output. Edition of feet must be 10 and for inches it must be 14 but it is printing 11 2 because inches are added to 14. So 14 is greater than equals to 12. So 14 is subtracted by 12. So inches are 2 and feet is incremented by 1. So instead of 10 it is 11. So if we add 5 feet 6 inch with 5 feet 8 inch so the converted result will be 11 feet and 2 inches. So this way the program is working properly. I have implemented this code with help of structure and pointer. So I hope you have understood how we can process structure variables through structure pointers. If you want to watch more programming related videos you can search my name Sanjay Gupta in YouTube search. My channel will be available there. You can watch various programming related videos there. Thank you for watching this video.