Why do we have to use Node* node =new Node(value) ?

Правка en1, от abhinav700, 2023-04-24 09:36:37

While declaring a link list, why do we create a new Node using Node* node = new Node(value) ? Can't we simply use Node node(val) if not, then why? and if we can, what are changes to our code we will have to make while using later syntax, for basic operations on link lists?

I was revising link list, and although I can solve the questions, I was confused with this syntax.

Теги c++, doubt, help, beginner

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский abhinav700 2023-04-24 09:36:37 438 Initial revision (published)