Skip to content

Tag Archives: C-Struct-Union-Enum

In this article, we will discuss structures, unions, and enumerations and their differences. The structure is a user-defined data type that is available in C++. … Read More
Array within a Structure A structure is a data type in C/C++ that allows a group of related variables to be treated as a single… Read More
Given student’s records with each record containing id, name and age of a student. Write a C program to read these records and display them… Read More
In this article, we will be analyzing “static const”, “#define” and “enum”. These three are often confusing and choosing which one to use can sometimes… Read More
Standard C90 requires the elements of an initializer to appear in a fixed order, the same as the order of the elements in the array… Read More
Flexible Array Member(FAM) is a feature introduced in the C99 standard of the C programming language. For the structures in C programming language from C99… Read More
Prerequisite : Structures in CName and marks in different subjects (physics, chemistry and maths) are given for all students. The task is to compute total… Read More
In C, we can specify size (in bits) of structure and union members. The idea is to use memory efficiently when we know that the… Read More
Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a… Read More
Like Structures, union is a user defined data type. In union, all members share the same memory location. For example in the following C program,… Read More
What is a structure? A structure is a user defined data type in C/C++. A structure creates a data type that can be used to… Read More
What will be the size of following structure? filter_none edit close play_arrow link brightness_4 code struct employee {     int     emp_id;     int     name_len;     char    name[0]; };… Read More
What do we mean by data alignment, structure packing and padding?Predict the output of following program. c filter_none edit close play_arrow link brightness_4 code #include… Read More
In C, the only operation that can be applied to struct variables is assignment. Any other operation (e.g. equality check) is not allowed on struct… Read More