这是我的结构的定义
typedef struct treeNode
{
int data,pos;
char name[16];
struct treeNode *left;
struct treeNode *right;
}treeNode;
我创建了一个动态对象
treeNode *temp;
temp = (treeNode *)malloc(sizeof(treeNode));
如果我必须为数据分配一个值,我应该如何分配
scanf("%d",temp->data); //or
scanf("%d",&(temp->data)); //why? because all scanf will look for is address to a location which could be done by temp->data;
这也适用于访问数据,即我应该如何访问整数部分?
temp->data; //or
*(temp->data)