Structs do nothing to replace functions or arrays. Rather, structs make it easier to use functions and arrays when you have multiple pieces of information, possibly of different data types, that relate to a single object.
Using your example, if you did not have structs, you would need three separate arrays to store many food items. Each of these arrays might have to be passed as function arguments, and you have to be careful to use the same index on each array to refer to the same item.
Now, simply make an array of your composite data type, as in:
shopping_list.letter = 'A';
shopping_list.food = "Chicken Noodle Soup";
shopping_list.price = 1.45;
//and so on for the other 9 items - a loop would be handy here
With this, a function to display your entire shopping list could have a declaration like:
void show_list( foodmenu list, int num_items );
Isn't that much easier than passing three arrays, one of char, one of string, one of double?
I am working creating a fully encapsulated, homogeneous singly linked data structure. The Listing class and SinglyLinkedList class that are part of the whole application compile fine, but the problem ...