It is safe to pass a null pointer to free, so if your array is initialized with null pointers, you can safely free all arr[i], assuming you only store pointers return by malloc() and friends and do not free them elsewhere.
Define the array as
char *arr[3] = { NULL, NULL, NULL };
or simply
char *arr[3] = { 0 };
NULL, 0 and '\0' may be used to specify a null pointer, but it is advisable to follow a simple rule of clarity:
- use NULLfor a null pointer,
- use 0for a null integer,
- use '\0'for a null byte in an array ofchar, which is also called the null terminator.
And you can use = { 0 }; as an initializer for any C object: all elements and members will be intialized to the zero value of their type, except for unions where only the first member is initialized this way.