User-Defined Structure Types:
A structure is a user-defined data type that allows a programmer to group
related data items of different data types under a single name. Structures are
used to represent real-world entities that have multiple attributes.
Each member of a structure is accessed using the dot (.) operator. Structure
definitions create a template that can be used to declare multiple structure
variables. Structures improve program organization by logically grouping related
data.
A structure is a user-defined data type that allows a programmer to group
related data items of different data types under a single name. Structures are
used to represent real-world entities that have multiple attributes.
Each member of a structure is accessed using the dot (.) operator. Structure
definitions create a template that can be used to declare multiple structure
variables. Structures improve program organization by logically grouping related
data.
SYNTAX:
struct tin{
int id;
float weight;
char brand;
};
EXAMPLE:
#include <stdio.h>
struct tin{
int id;
float weight;
char brand;
};
int main() {
struct tin t1= {37846,56.7799,'C'};
printf("%d\n",t1.id);
printf("%.2f\n",t1.weight);
printf("%c",t1.brand);
return 0;
}