What are Structures in C?
Structures are a collection of locally declared variables in C. Structures are used to group together an assortment of related variables together, which allows for better handling by the programmer. For example, you want to store information about a new bike in the computer. Instead of storing information about its mileage, different parts, top speed under different names, you can use a single name (structure) to group these variables together.
struct bike_details {
char* pmake;
char* pRegistration;
int mileage;
int top_speed;
};
No comments:
Post a Comment