Flatten a LinkedList

https://online.codingblocks.com/player/7408/content/1353?s=1478

In this video in this
if(root->left !=NULL && root->right==NULL){
LinkedList leftLL=flatten(root->left);
leftLL.tail->right=root;

	l.head=left.head;
	l.tail=root;
	return l;
	 	
}

please tell that leftLL.tail->right ?is wriitten here how iit can be tail->right?

Hey Harshita, in this code

if(root->left!=NULL and root->right==NULL){
		LinkedList leftLL = flatten(root->left);
		leftLL.tail->right = root;
		l.head = leftLL.head;
		l.tail = root;
		return l;
	}

basically leftLL.tail is a node and every node has a right pointer so yes we can do this to attach the root node at the right of the Linkedlist which we are getting from left tree of the root by flatten(root->left);.