编辑代码

#include <stdio.h>
#include <stdlib.h>

typedef struct TEST
{
    int num1;
    int num2;
}test;
 
int main () {
    int *ptr1 = (int *)malloc(sizeof(int));
    *ptr1 = 1;
    free(ptr1);
    // ptr1 = NULL;
    if (ptr1 == NULL)
    {
        printf("This pointer is Null.\r\n");
    }
    else
    {
        printf("The pointer address is 0x%x\r\n", ptr1);
        // printf("%d\r\n", *ptr1); // 不置NULL时,再读取为空数据;或者直接报错。。
    }
    return 0;
}