不同函数里的标签名是否可以相同?

screen12 2014-10-30 11:03:54
标签就是用goto语句跳转到的那个标签,比如:
goto label1
...
...
label1:
...

我想问的是:不同函数中的标签可以相同吗?标签唯一性的范围是什么?
...全文
117 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
常书 2014-10-30
  • 打赏
  • 举报
回复
引用 5 楼 mymtom 的回复:
http://flash-gordon.me.uk/ansi.c.txt
thank you!
mymtom 2014-10-30
  • 打赏
  • 举报
回复
常书 2014-10-30
  • 打赏
  • 举报
回复
引用 3 楼 mymtom 的回复:
3.1.2.1 Scopes of identifiers An identifier is visible (i.e., can be used) only within a region of program text called its scope . There are four kinds of scopes: function, file, block, and function prototype. (A function prototype is a declaration of a function that declares the types of its parameters.) A label name is the only kind of identifier that has function scope. It can be used (in a goto statement) anywhere in the function in which it appears, and is declared implicitly by its syntactic appearance (followed by a : and a statement). Label names shall be unique within a function.
版主大人,这段出自哪里?
mymtom 2014-10-30
  • 打赏
  • 举报
回复
3.1.2.1 Scopes of identifiers An identifier is visible (i.e., can be used) only within a region of program text called its scope . There are four kinds of scopes: function, file, block, and function prototype. (A function prototype is a declaration of a function that declares the types of its parameters.) A label name is the only kind of identifier that has function scope. It can be used (in a goto statement) anywhere in the function in which it appears, and is declared implicitly by its syntactic appearance (followed by a : and a statement). Label names shall be unique within a function.
常书 2014-10-30
  • 打赏
  • 举报
回复
可以相同,GOTO不会GO到另一个函数去,同一个函数内唯一即可
常书 2014-10-30
  • 打赏
  • 举报
回复
可以相关同,GOTO不会GO到另一个函数去
女神打Boss 2014-10-30
  • 打赏
  • 举报
回复
是一个局部的。。
勤奋的小游侠 2014-10-30
  • 打赏
  • 举报
回复
可以,只在函数内起作。
707wk 2014-10-30
  • 打赏
  • 举报
回复
没试过,但这样做不会导致理解错误吗

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧