2024 views|0 replies

2015

Posts

0

Resources
The OP
 

The problem of increasing brackets in single chip computer programming [Copy link]

Keywords such as if, do, while, switch, for, else, case, default, etc. must be followed by curly braces {}, even if there is only one statement behind them. Because when I was writing microcontroller programs under Keil, I encountered problems without {}. Although it is difficult to explain, adding curly braces does not waste time. Among them, case and default are more difficult to understand. It is okay not to add them, but adding them makes the program look more refreshing! Among them, break can be placed outside the curly braces! For example: int main(void) [color=#00 0000]{ int a; cout<<"Please input a"<" cin="" color][="" size]="">>a;
    switch(a)
    {
    case 1:
        {
            cout<<"a = 1"<" break;[="" case="" color][="" cout<<"a='2"<<endl;' default:[="" div="" is="" other"<
The problem of increasing brackets in single chip computer programming


This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list