
c语言goto语句用法
goto语句可以使程序在没有任何条件的情况下跳转到指定的位置,所以goto语句又被称为是无条件跳转语句。
推荐学习:编程入门教程
它的语法如下
goto label; //其它代码 label:
其中,label为我们自己定义的一个标签,定义的规则与变量的命名相同,它的位置是不固定的,它可以写在goto语句的后面,也可以写在它的前面,然而goto语句只能在一个函数内部跳转,它并不允许跳转出一个函数外部。
int day = 1; loop: if (day <p>上面程序就是利用了goto和if语句来实现了循环功能,它与while实现的循环功能一样,其中loop为我们定义的一个label(标签)。</p><div class="aritcle_card flexRow artxards"> <div class="artcardd flexRow"> <a class="aritcle_card_img" rel="nofollow" href="/ai/2074" title="XYZ SCIENCE"><img src="https://img.php.cn/upload/ai_manual/000/000/000/175680200236907.png" alt="XYZ SCIENCE" onerror="this.onerror='';this.src='/static/lhimages/moren/morentu.png'" ></a> <div class="aritcle_card_info flexColumn"> <a rel="nofollow" href="/ai/2074" title="XYZ SCIENCE" class="overflowclass">XYZ SCIENCE</a> <p class="overflowclass">一款面向学术文本的AIGC内容检测与改写工具,用于辅助判断论文文本的AI生成特征并进行文字调整。</p> </div> <a rel="nofollow" href="/ai/2074" title="XYZ SCIENCE" class="aritcle_card_btn flexRow flexcenter"><b></b><span>下载</span> </a> </div> </div><p><img src="https://img.php.cn/upload/image/848/613/828/1583745789661591.jpg?x-oss-process=image/resize,p_40" title="1583745789661591.jpg" alt="241f95cad1c8a786545a6fa96a09c93d70cf5020.jpg"></p><p>注:避免使用goto语句,它会打乱程序结构,不易阅读。</p><p>推荐学习:<a href="https://www.php.cn/course/list/37.html" target="_blank">c语言视频教程</a></p>
13万字C语言保姆级教程(深入):立即使用
在学习笔记中,你将探索c语言的核心概念和高级技巧!










