As defined, test_ptr can't ever be NULL. test_ptr is an array, not a pointer. It does degenerate into a pointer (which is to say it's implicitly converted into a pointer) when treated as a pointer, but not one that is NULL.
I think you want
TEST* test_ptr = NULL;
You can still use the [] indexing notation because
p[i]
is just another way of saying
*(p+i)
which actually expects a pointer.
Demonstration:
#include <stdio.h>
typedef struct {
int a;
int b;
int c;
} Test;
static Test tests_arr[] = {
{ 1, 2, 3 },
{ 3, 4, 5 },
};
int main(void) {
printf("%d\n", tests_arr[1].b); // 4
printf("%d\n", (tests_arr+1)->b); // 4
printf("%d\n", (&(tests_arr[0])+1)->b); // 4
Test* tests_ptr = NULL;
printf("%s\n", tests_ptr == NULL ? "NULL" : "Not NULL"); // NULL
tests_ptr = test_arr;
printf("%s\n", tests_ptr == NULL ? "NULL" : "Not NULL"); // Not NULL
printf("%d\n", tests_ptr[1].b); // 4
printf("%d\n", (tests_ptr+1)->b); // 4
tests_ptr = &(test_arr[0]);
printf("%s\n", tests_ptr == NULL ? "NULL" : "Not NULL"); // Not NULL
printf("%d\n", tests_ptr[1].b); // 4
printf("%d\n", (tests_ptr+1)->b); // 4
return 0;
}