我有以下脚本:
typedef struct {
uint8_t red;
uint8_t green;
uint8_t blue;
} color;
color c1;
color* c2 = malloc(sizeof(color));
Run Code Online (Sandbox Code Playgroud)
我想知道 c1 和 c2 的存储位置。我知道 malloc 存储在堆上,但是 c2 是一个指针并且那些存储在堆栈中?c1 是存储在堆上还是堆栈上?