Well, firstly, for general use you should use the standard library: std:vectoror if you really need a linked list, std::list<>.But, since this is a self-learning exercise, we will skip this.
: , , ? Cout
, , :
read = new node;
read->next = NULL;
read->value = val;
node next null. , :
read = new node(val);
: pop() :
node* write = read;
if(read->next == NULL)
{
delete read;
read = NULL;
return write;
}
read null - , . write, read, .
, ++ Object-oreitned: cout, C, new delete. , . , List, node .