Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What does the variable array name at the end of the structure's definition means?

I’ve already read this, this and this but it seems they’re not exactly my situtation.

I have a code like this

struct ppl_weight {
    uint16_t weight;
    uint8_t weightHour;

} ppl_weightList[16];

but I can’t understand the array at the end of the struct. What does it mean? Have I an array of 16 struct? How does I manage this data type?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It is a declaration of an array with 16 elements of the type struct ppl_weight. You could split this declaration

struct ppl_weight {
    uint16_t weight;
    uint8_t weightHour;

} ppl_weightList[16];

the following way

struct ppl_weight {
    uint16_t weight;
    uint8_t weightHour;

};

struct ppl_weight ppl_weightList[16];
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading