In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "what is the branch and loop of C language". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn "what is the branch and loop of C language"!
What is a sentence
We often put a semicolon at the end of a piece of code. In C language, the semicolon is preceded by a statement, such as
Int a = 0 role / this is a statement printf ("% d\ n", a); this is another statement
It's a simple concept.
So, if you put a semicolon and write nothing before the semicolon, does it count as a statement?
A: yes, of course. This is a small point to pay attention to.
II. Branch statement
The branch sentence is also called choice structure, for example, if you study hard, you can find a good job; if you play games all day, it means you choose to lose your job after graduation. Whether to study hard or play games, this is your choice, your choice will bring the corresponding results, this is the branch sentence.
Branch statement:
If
Switch
1.if statement
The structure of the if statement:
If (conditional) statement (result); else statement (result)
If the conditions in if parentheses are met, the statement under if is executed, otherwise the statement under else is executed.
There is a structure above, and another is called a multi-branch structure:
If (condition) (statement); else if (condition) (statement); else (condition) (statement)
In fact, in the previous structure, there is an extra choice of else if.
Next, I'll give you a complete example, taking weight as an example.
# include int main () {int weight = 0; scanf ("% d\ n", & weigth); if (weight100 & & weight)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.