typedef struct { uint8_t data1; uint8_t data2; }data_type; data_type data_instance = { 10, 20 }; data_type *data; void ptr_func(data_type **data_ptr) { data = (data_type *)&data_instance; data->data1 = 30; *data_ptr = data; } int main(void) { data_type *handle; ptr_func(&handle); handle->data1 = 50; handle->data2 = 100; }
常用于动态内存申请