약간 혼란 스럽다. 내 흐름이 옳았지만 Seg을 얻고있는 것처럼 보였다. 오류 (라인 15) 헤더C 구조체 초기화 및 포인터로 액세스
내 구조체 :
이ringBuf_t *create() {
ringBuf_t buf = {.capacity = BUF_CAPACITY, .head = 0, .tail = 0};
return &buf;
}
int push(ringBuf_t *buf, uint32_t item) {
if (buf->head + 1 == buf->tail) {
return -1;
}
buf->data[buf->head] = item;
buf->head = (buf->head + 1) % buf->capacity;
return 0;
}
줄 번호가있는 코드를 게시하지 마십시오! – chqrlie