Intro
Linked Lists Introduction
#include <iostream>
using namespace std;
struct node{
string s;
node* next;
};
void walk(node* np){ //recursive function
//if (np==0) return;
//if (np !=0 ) //remember 0 is false and anthing else is true
if (np)
{
cout<<np->s<<endl;
walk(np->next);
}
}
int main(){
node A,B,C;
A.s="adam";
B.s="bob";
C.s="cathy";
A.next= &B;
B.next= &C;
C.next=0; //nullptr
node* root=&A;
walk(root);
/*
while (root!=0)
{
//cout<<(*root).s<<endl;
//root=(*root).next;
cout<< root->s <<endl;
root = root->next;
}
*/
return 0;
}