#include <stdio.h>
int main()
{
goto lb;
static int a=5;
lb:
goto b;
int b=6;
b:
printf("%d %d",a,b);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我使用".c"文件扩展名保存此代码时,它运行良好,输出为5,后跟"垃圾"值.
但是,在C++中,它会导致错误.我无法理解为什么会有错误.你能告诉我怎么解决吗?