I was shown many ways of using calloc and malloc: with casting, without, etc So here I have two option how I can use calloc. I am curious which one is right for x86 isa.
If I have the following:
typedef struct node{
int numOfOccur;
int numOfSuperWords;
struct node *children;
}NodePtr;
NodePtr* temp = &root;
How would be correct to allocate memory using calloc.
Option 1
temp -> children[currChar].children = (NodePtr *)calloc(27, sizeof(struct node));
Option 2
temp -> children[currChar].children = calloc(27, sizeof(children[currChar].children));