/*****************************************************************************
 * 'main' illustrates automatic, static, and dynamic memory.
 * **************************************************************************/
#include<iostream>
#include<iomanip>

using std::cin; using std::cout;
using std::endl; 
struct Link
{
	int value;
	Link* next;
};

int* valid_pointer()/* The pointer this returns can be deallocated with
		      * "delete". */
{
	int* x=new int(111);
	return x;
}
	

int main()
{
	Link* p= new Link;
	(*p).value=10;
	(*p).next=new Link;
	Link* current=(*p).next;
	(*current).value=20;
	(*current).next=new Link;
	current=(*current).next;
	current->value=30;
	current->next=NULL;
	for(Link* c=p; c!=NULL;c=c->next)
		cout<<c->value<<" ";
	return 0;	


}

	
