通信,电信,互联网技术论坛
发新话题
打印

C语言中goto语句的使用

C语言中goto语句的使用

使用goto语句时,如果关键字"goto"与标号之间出现变量的定义时,就会有错误,不知为什么。
例如:

...
goto aa;
    int n=5;
    n+=6;
aa:
...
但如果这样就不会有错误:
...
goto aa;
{
    int n=5;
    n+=6;
}
aa:
...


或者这样:
...
int n;
goto aa;
    n=5;
    n+=6;
aa:
...
也不会有错误。

TOP

发新话题