当前位置:网站首页>Goto of C language
Goto of C language
2022-07-20 12:32:00 【free(me)】
List of articles
Preface
What this article records is C In language goto knowledge .
One 、goto Usage of
goto The usage of is to change the order of program execution , Jump from somewhere to the place you sign .
An example I encountered in a real application scenario is : The program encounters an error and jumps to the specified flag to execute the code ( Print error messages , Then end the function )
Two 、 Sample code
1. Conditions established , Direct jump
The code is as follows ( Example ):
#include<stdio.h>
int main() {
int c = 1;
if (c > 0) {
goto start;
}
printf(" power 1\n");
printf(" example 2\n");
printf(" example 3\n");
start:
printf(" example 4\n");
printf(" example 5\n");
}
result :if Conditions established , Jump directly to start sign , Output instance 4 And examples 5. example 1、2、3 Don't execute .
2. Conditions not established
The code is as follows ( Example ):
#include<stdio.h>
int main() {
int c = 1;
if (c < 0) {
goto start;
}
printf(" power 1\n");
printf(" example 2\n");
printf(" example 3\n");
start:
printf(" example 4\n");
printf(" example 5\n");
}
result : Output instance 12345, because if Conditions not established , Then execute in sequence , Instance executed 123 in the future ,start It's just a sign , So the program will still be executed . Unless you are outputting instances 3 Add a return, Then do not execute the instance 45.
边栏推荐
- 请问如果需要动态提交sql作业并控制启停等该如何实现?
- Software of synonymous sentence conversion online translator
- [solution] the Monaco editor in leetcode cannot be loaded
- KVM deployment and Application
- How much is the price of the moving ring monitoring system
- notepad++如何取消空行
- 解决:配置、路径完全没错 gateway就是访问不了
- Flask request data and get response
- Chinese synonymous sentence online converter - Chinese synonymous sentence converter software
- 2022牛客多校联赛第一场 题解
猜你喜欢
kvm部署及应用
Dynamic ring monitoring module, dynamic ring monitoring module classification
秋招之前,这8篇推荐系统的论文一定要读!【附论文资料】
【虹科新闻】虹科电子与WEKA正式建立合作伙伴关系
KVM deployment and Application
Reflective Decoding: Beyond Unidirectional Generation with Off-the-Shelf Languag
Starbucks may close more U.S. stores in the future due to concerns about the safety of employees
Comparison of gold content between PRINCE2 and PMP
DOM introduction and acquisition of DOM series
Fault 006: connection sorting and de duplication results are not as good as people want
随机推荐
C语言之goto
Brand new! Uncover the promotion route of Ali P5 Engineer ~p8 architect
Keep the number of float type to 2 decimal places
Mathematics learning in Xinao: video collection of mathematics in primary school, junior high school and senior high school
[golang learning notes 1.7] functions in golang should be used
IPv6 basic
Exclusive thought of DOM series
Filter setting of can
Science animation, etc
Optimization case 2: select scalar subquery and sort main query
JUC_synchronized关键字详解
DOM introduction and acquisition of DOM series
数字沙盘的三大应用功能科普
Ipv6-icmpv6 protocol
Vs2017 opencv3.4.2 is compiled into x86 through the release version source code
flink读取的mysql数据,出现重复消费,需要怎么处理
Spec206 detailed parameters and summary of common problems in the test process (with example operation)
Use of pH meter, conductivity meter and chlorophyll fluorescence meter
LeetCode_93_复原IP地址
新闻速递 | 恭喜肖晓容工程师获得Domo专业认证!