ABSTRACT

In real-life scenarios, we come across objects that contain several attributes. For instance, a book has a name, a number of pages, and a price. All these attributes are of a different type; the name is a character type, pages are integers, and the price is floating point. To store the information about this book, we need a special data type, and in C language, this is known as a structure. This chapter discusses all the concepts associated with a structure, such as its declaration, initialization, accessing the structure's members, an array of structures, and a nested structure. Similarly, a union is another data type, one which stores the objects and follows a slightly different rule than a structure. This chapter introduces several new keywords like typedef and enum. Other advanced concepts like bitfields and self-referential structures are also discussed.