189: Creating a linked list by inserting at end

PHOTO EMBED

Tue May 23 2023 18:24:39 GMT+0000 (Coordinated Universal Time)

Saved by @saakshi #c++

void InsertLast(int x){
  Node *t = x;
  t->data= x;
  t->next= NULL;
  if(first==NULL){
    first= last= t;
  } else {
    last->next= t;
    last=t;
  }
}
content_copyCOPY