wats the error over here:
Code:
void addlist(node* headptr,int c)
{
	
	cout<<"headptr value after being passed"<<headptr->val<<endl;
			node* temptr11 = new node;
			node* temptr1 = headptr;
			cout<<"temptr val after being assigned to headptr"<<" "<<temptr1->val<<endl;
			
			for ( int v = 0; v < c; v++ )
			{
			
			node* nodeptr1 = new node;
                   
		    nodeptr1->colval = v;
			cout<<"nodeptr1 colvalue in addlist"<<" "<<nodeptr1->colval<<endl;

		           
		     
		 if( temptr1!= NULL )
		 
while(temptr1 != NULL )
		 {
			 
			if ( nodeptr1->colval == temptr1->colval)
			{
				cout<<"afetr entering in if consition nodeptr1 colvalue"<<" "<<nodeptr1->colval<<" and temptr1 value"<<" "<<temptr1->colval<<endl;
				nodeptr1->val += temptr1->val;
			}
			else
				temptr1= temptr1->next;
		}
		if ( headptr1 == NULL )
		{
			headptr1 = nodeptr1;
		}
		else
		{
			if ( headptr1 != NULL )
			{
			while(temptr11->next != NULL )
			{
				temptr11 = temptr11->next;
			}
			}
		}
		 
   }
}
the headptr is just passing the headpointer of a linked list to take values from it and than to take values from its nodes to add and store the result in our new linked lists.
there is some logical error but i couldnt find it out