I have to initialize a string array consisting only of a NULL pointer, nothing else. If I understand correctly assigning a NULL pointer looks like this:
char **array = NULL;
Otherwise, I tried
char *array[] = {NULL};
But the space for the NULL pointer should be dynamically allocated and here I'm confused, my code doesn't work.
char **array = (char**)malloc(sizeof(char*));
I would be really grateful if you could help me with this.
nullor points to a (memory location containing)null. Which one do you want?calloc()can't portably do this. Also, don't cast the return value ofmalloc()and friends in C.