gpt4 book ai didi

c - 错误 : A label can only be part of a statement

转载 作者:太空狗 更新时间:2023-10-29 14:57:56 26 4
gpt4 key购买 nike

<分区>

我正在用 C 写一个脑残的解释器,我在使用一些我不习惯的东西时遇到了一些麻烦。在 brainfuck 中,逗号 (,) 本质上是 getchar()。所以我有以下代码:

//This is just ptr
static char *ptr;

switch (command)
{
case ',':
*ptr=getchar(); // Here's the code causing error
break;
}

当我尝试编译它时,gcc 向我抛出 error: a label can only be part of a statement and a declaration is not a statement

有什么想法吗? (抱歉,对这个错误不是很熟悉)

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com