Hey guys im loading some data from a file into memory using the structs.. i need to allocate some memory for it using malloc but im unsure which variables i need to use to allocate memory for the structs.
could someone also explain a little more about the structs
Code:typedef struct category* CategoryTypePtr; typedef struct item* ItemTypePtr; /* Structure definitions. */ typedef struct price { unsigned dollars; unsigned cents; } PriceType; typedef struct item { char itemID[ID_LEN + 1]; char itemName[MAX_NAME_LEN + 1]; PriceType prices[NUM_PRICES]; char itemDescription[MAX_DESC_LEN]; ItemTypePtr nextItem; } ItemType; typedef struct category { char categoryID[ID_LEN + 1]; char categoryName[MAX_NAME_LEN + 1]; char drinkType; /* (H)ot or (C)old. */ char categoryDescription[MAX_DESC_LEN]; CategoryTypePtr nextCategory; ItemTypePtr headItem; unsigned numItems; } CategoryType; typedef struct gjc { CategoryTypePtr headCategory; unsigned numCategories; } GJCType;



LinkBack URL
About LinkBacks


