 Hello friends, I am Sanjay Gupta. In this video, I am going to discuss the differences between structure and union in C programming. Before starting, you can note how you can search my YouTube channel. You can simply type my name Sanjay Gupta in YouTube search. My channel will be available there. You can watch various programming related videos there. Now let's discuss the differences between structure and union. So first structure, here keyword struct is required. In case of union, here keyword union is required. So this is the first difference between structure and union. In case of structure, we use struct keyword and in case of union, we use union keyword. Now second difference structure, it allocates separate memory blocks to each member. So in case of structure, if you have four members, then four separate memory blocks as per their data type will be allocated automatically. Now in case of union, it allocates memory to the block which requires highest amount of memory and remaining members share that memory. So in case of union, memory will be allocated to the member which requires highest amount of memory and remaining members share that memory. So in case of union, only one block will be allocated for n number of members and remaining members will be sharing that memory. So this is the second difference. Now third difference. So first structure, here we can assign values to each member of structure at same time. But in case of union, we can't do so. So here we can assign value to any one of the member at a particular time. You cannot assign values to all the members at same time in case of union because union has a particular memory block which is common for all the members. So if a particular member is using that memory block, then another member cannot use that memory block. If you want to share that memory block with other members, then its previous members value will be overwritten and new value will be placed. So structure assigns values to each member at same time. But this is not possible in case of union because union is applying sharing nature. Now fourth difference, that is for structure, here memory waste performed. So if you are not using all the members at same time, then there may be chances of memory waste. But here in case of union, memory can be saved. So if you want to share memory and if you want to use different members at different point of time, then you can prefer union. Now there are syntaxes. So this is the last difference. So first I am writing the syntax of structure. So for structure, you have to use the keyword struct, then name of structure, then data type, variable 1, data type, variable 2, data type, variable n. So this way you can declare a structure. Now I am going to write syntax of union. So here you have to use the keyword union, then name of union and rest of the statement will be same as structure. So this is the syntax of union. So these are some differences which are available between structure and union. Both have their unique advantages and they also have their drawbacks. So if you want to use all the members of a particular variable, it can be structure or it can be union. If you want to use all the members, then instead of declaring it union, prefer to declare it as structure. But if you want to use a particular member at a particular time and remaining members are not used when a particular member is used, then declare union instead of structure. So these are the differences between structure and union in C programming. I hope you have understood whatever I have discussed in this video. If you want to watch more programming related videos, you can search my channel by my name Sanjay Gupta in YouTube. Thank you for watching this video.