#include <stdio.h>
#include <string.h>
struct Queue {
int* const elems; //elems申请内存用于存放队列的元素
const int max; //elems申请的最大元素个数max
int head, tail; //队列头head和尾tail,队空head=tail;初始head=tail=0
};
void initQueue(Queue* const p, int m) {
(int*)(p->elems) = (int*)malloc(m * sizeof(int));
int* max2 = const_cast<int*>(&(p->max));
*max2 = m;
p->head = p->tail = 0;
}
initQueue函数内部的第一行会报错,显示左操作数必须是左值,但是这里明明用了int*的强制转换了,有大佬知道为什么吗?