当前位置:网站首页>[C language] break and continue in switch statement
[C language] break and continue in switch statement
2022-07-03 23:58:00 【YeMing_ LCH】
We're writing switch In the process of statement , Usually each case( or default) The following sentences are marked with “break” ending :
switch (int)
{
case int1:
...;
break;
case int2:
...;
break;
default:
...;
break;
}
If you don't write break What will happen? ?

According to our preset idea , Should carry out case 0: Under the code , The result should be b=2.
The actual operation result is b=1, Explain that after execution b++ After that, the code didn't jump out switch Statement to execute printf, Instead, it went on default Under the b--, Cause the final result to deviate .
And add break There is no problem with the result of running after the statement !

So I'm writing switch Be sure to pay attention to this small detail when you write sentences !!!
So I'm writing switch Be sure to pay attention to this small detail when you write sentences !!!
So I'm writing switch Be sure to pay attention to this small detail when you write sentences !!!
( Important things are to be repeated for 3 times )
边栏推荐
- Pandaoxi's video
- [MySQL] classification of multi table queries
- Gossip about redis source code 76
- I wrote a chat software with timeout connect function
- Gossip about redis source code 73
- China standard gas market prospect investment and development feasibility study report 2022-2028
- Design of logic level conversion in high speed circuit
- 网上的低佣金链接安全吗?招商证券怎么开户?
- Generic tips
- Gossip about redis source code 79
猜你喜欢

The difference between single power amplifier and dual power amplifier

Kubedl hostnetwork: accelerating the efficiency of distributed training communication

Deep learning ----- using NN, CNN, RNN neural network to realize MNIST data set processing

ESP Arduino playing with peripherals (V) basic concept of interrupt and timer interrupt

Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?

Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?

Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?

Common mode interference of EMC

Iclr2022: how does AI recognize "things I haven't seen"?

Tencent interview: can you pour water?
随机推荐
Is user authentication really simple
Design of logic level conversion in high speed circuit
STM32 GPIO CSDN creative punch in
It is the most difficult to teach AI to play iron fist frame by frame. Now arcade game lovers have something
想请教一下,十大劵商如何开户?在线开户是安全么?
Enter MySQL in docker container by command under Linux
Regular expressions and text processors for shell programming
Gossip about redis source code 73
[source code] VB6 chat robot
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
Idea a method for starting multiple instances of a service
ESP Arduino playing with peripherals (V) basic concept of interrupt and timer interrupt
Suggestions for improving code quality
Tencent interview: can you pour water?
[MySQL] sql99 syntax to realize multi table query
P1629 postman delivering letter
Zipper table in data warehouse (compressed storage)
Version rollback revert don't reset better reset must be forced
ITK learning notes (VII) the position of ITK rotation direction remains unchanged
SPI based on firmware library