Is there a way to create unique structs in a for-loop?

Let's say I have the following struct:

typedef struct ItemToPurchase_Struct{

    char itemName[ITEM_NAME_MAX_SIZE];
    int itemPrice;
    int itemQuantity;
    
}ItemToPurchase;

Would there be a way to create a for-loop that could create new unique instances (if that's the correct term to use..I'm new to C and structs) of the given struct instead of manually having to create each one?



Read more here: https://stackoverflow.com/questions/64416628/is-there-a-way-to-create-unique-structs-in-a-for-loop

Content Attribution

This content was originally published by kvnr at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: