Try this:
void printnode(NODE* n){
while(n->next){
cout << n->c;
n=n->next;
}
}
It uses a pointer to access NODE
.
In your version, you are are trying to assign a pointer to a non-pointer type:
void printnode(NODE n){
...
n = n.next; // error: n.next is of type NODE*, but n is a non-pointer NODE