Home > Back-end >  Bosses, please look at my writing this dynamic linked list is correct
Bosses, please look at my writing this dynamic linked list is correct

Time:09-27

Learning to dynamic linked list for the beginning of a serious, then their self-study, after watching some code, found that everyone is different, the writing of so I according to own understanding to write a simple dynamic linked list, bosses, please help to see if there is something wrong with me this kind of writing?
#include
#include
#include

using namespace std;

Typedef struct LNode
{
The int data;
Struct LNode * next;
} LNode * LinkList;
Int main ()
{
LinkList l, p;
L=(LNode *) malloc (sizeof (LNode));
L - & gt; Next=NULL;
int i;
for(i=0; i<5; I++)
{
P=(LNode *) malloc (sizeof (LNode));
Cin & gt;> p-> The data;
Cout & lt; The data & lt; <"";
p-> Next=NULL;
L - & gt; Next=p;
}
return 0;
}