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;
和我的结构的Def这也适用于访问数据也即我应该如何访问整数部分?
temp->data; //or
*(temp->data)
[不要强制'malloc'](http://stackoverflow.com/a/605858/1848654)。 – melpomene