1
我看到了很多使用calloc和malloc的方式:使用cast,without等 所以在这里我有两个选项我可以使用calloc。我很好奇哪一个适合x86 isa。什么是使用calloc for x86 ISA的正确方法
如果我有以下几点:
typedef struct node{
int numOfOccur;
int numOfSuperWords;
struct node *children;
}NodePtr;
NodePtr* temp = &root;
如何将正确的使用calloc分配存储空间。
选项1个
temp -> children[currChar].children = (NodePtr *)calloc(27, sizeof(struct node));
选项2
temp -> children[currChar].children = calloc(27, sizeof(children[currChar].children));
调用'calloc'的正确方法是独立于ISA。 – 2014-10-04 18:34:12
那么为什么在旧书中我们需要所有这些铸造..但今天人们使用它,而无需铸造和其他东西。有些东西改变了 – YohanRoth 2014-10-04 18:35:35
语言可能已经改变。这与ISA无关。 – 2014-10-04 18:36:01