#include
#include
#include
using namespace std;
typedef struct LNode{
int data;
LNode* next;
}LNode,*List;
void creat(LNode* L){
List p ;
int n;
p= (List)malloc(sizeof(LNode));
L = p;
printf("请输入1(添加)或0(不添加):\n");
cin >> n;
while (n)
{
p = (List)malloc(sizeof(LNode));
printf("请输入节点数据:\n");
cin >> p->data;
p->next = p;
printf("请输入1(添加)或0(不添加):\n");
cin >> n;
}
}
void get(LNode* L){
List p = L;
if (p == NULL)exit(0);
while (p->next != NULL)
{
printf("节点数据:%d\n", p->next->data);
p = p->next;
}
}
void main(){
LNode L;
creat(&L);
get (&L);
}
怎么才能改变LNode的L变量,指针不懂,为什么他没有改变啊