#include <iostream>
//basic int node for linked list
struct intNode {
int item;
intNode * next;
};
//uses compound initalizer to make a node.
intNode getnode(int arg) {
return intNode{arg};
}
//makes a linked list of some length
intNode makelist(int length){
intNode base = {0};
for(int i=1;i<length;i++){
base = intNode{i, &base};
}
return base;
}
//traverse a linked list and print the contents
void traverse(intNode list){
intNode * point = &list;
do {
intNode hold = *point;
std::cout << hold.item << std::endl;
point = hold.next;
} while(list.item != 0);
}
int main() {
intNode f = makelist(8);
traverse(f);
}
/*7
-1437250888
exited with non-zero status*/