I tend to disagree.
Originally Posted by MutantJohn
You typedef a pointer which makes your code harder to read. I would suggest something like:
which makes it clear that "omfg" is a pointer to pointer to pointer to node_t. (Actually I don't see a reason for the typedef at all instead of just using "struct xxx" as the type.)
typedef struct node
node_t ***omfg = malloc(gl * sizeof(*omfg));
Notice also how I use "omfg" with the sizeof operator. The basic idea is to always dereference the variable you are allocating memory for:
Thus if you ever have to change the type of your pointer (T) you can do it at one single line.
var_name = malloc(sizeof(*var_name));
The same works for your other two malloc() calls:
omfg[i] = malloc(gl * sizeof(*omfg[i]));
omfg[i][j] = malloc(gl * sizeof(*omfg[i][j]);