#include<iostream>
#include<conio.h>
#include<string.h>
#define OK 1
#define MAXSIZE 100
using namespace std;
typedef int Status;
#define OK 1
typedef struct
{
char name[5];
float price;
}Book;
typedef struct LNode
{
Book Elem;
LNode *next;
}LNode,*List;
Status InitList(LNode *B)
{
B=new LNode();
if(!B)
exit(-1);
else
B->next=NULL;
return OK;
}
int main()
{
LNode *L;
List LL;
InitList(L);
cout<<L->next;
getch();
return 0;
}
指针是引用类型,链表结点初始化,我用指针传递,修改结点内容的值,应该L里内容会变的,但是没变,这是为什么呢?