新手请教c++问题
#include <iostream>using namespace std;
class book
{
public:
int id;
float doll;
book *next;
};
//book*head=NULL;
void CreateTable(book*);
void main()
{
book *head=NULL;
CreateTable(head);
cout<<head;
delete head;
}
void CreateTable(book*head)
{
book *p;
p=new book;
p->id=1;
p->doll=10.0f;
head=p;
cout<<head<<endl;
p=NULL;
return;
}
请问在这段代码中,怎么主程序中的head在调用函数CreateTable后指向的地址没有改变