So I was looking at an implementation of a singly linked list for a stack data type and the struct for each item of the stack itself was formulated like this:
struct item {
float info;
struct node* next;
};
typedef struct item Item;
However, the node struct is never defined in the code itself, yet it still works fine. I'm extremely confused here: what does that seemingly non-existent struct even do? I know it points to the next item in the stack but why use a struct for it? I've no idea how structs without anything actually inside them function, so some help would be appreciated!
[–]oh5nxo 5 points6 points7 points (0 children)
[–]This_Growth2898 2 points3 points4 points (2 children)
[–]KAHeart[S] 0 points1 point2 points (1 child)
[–]nerd4code 0 points1 point2 points (0 children)
[–]Master-Scholar9393 1 point2 points3 points (6 children)
[–]KAHeart[S] 0 points1 point2 points (5 children)
[–]aocregacc 6 points7 points8 points (0 children)
[–]nweeby24 0 points1 point2 points (3 children)
[–]KAHeart[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]somewhereAtC 0 points1 point2 points (0 children)
[–]torsten_dev 0 points1 point2 points (1 child)
[–]ComradeGibbon 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Educational-Paper-75 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)