C语言在函数中使用goto的问题?

C语言在函数中使用goto的问题#include <stdio.h>
#include <string.h>
int main()
{
A:{
printf("1\n");
}
void aa()
{
goto A;
}
printf("2\n");
aa();
}
编译后报错:error: label 'A' used but not defined
可是我需要goto在void aa()里,该怎么改?

交互式爱情
浏览 1304回答 2
2回答

慕神8447489

你这个程序有很大问题,首先函数不能嵌套定义,不能在一个函数中定义另一个函数,void aa() 定义在 main 函数中是不对的。第二&nbsp;goto&nbsp;不能跨函数跳转的。
打开App,查看更多内容
随时随地看视频慕课网APP