• c语言基础, , ,


    Enumeration (or enum) in C

    Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain.

    enum State {Working = 1, Failed = 0}; 

    定义枚举类型:

    Variables of type enum can also be defined. They can be defined in two ways:

    // In both of the below cases, "day" is 
    // defined as the variable of type week. 
    
    enum week{Mon, Tue, Wed};
    enum week day;
    
    // Or
    
    enum week{Mon, Tue, Wed}day;

    https://www.geeksforgeeks.org/enumeration-enum-c/

     

    //在linux系统下,printf函数是行缓冲式的输出,当printf遇到 时,或者缓冲区满时,才会将缓冲区里的内容刷新到标准输出(stdout).

     = CR (Carriage Return) // Used as a new line character in Mac OS before X

     = LF (Line Feed) // Used as a new line character in Unix/Mac OS X

     = CR + LF // Used as a new line character in Windows

    #include <stdio.h>//这一行不加也可以,但是会有警告。
    enum State {Working = 1, Failed = 0};
    int main(){
        enum State s;
        s = Working;
        printf("%daaaaaa
    123", s);
    //    fflush(stdout);
        return 0;
    }
                                                                      
    

      

    是另起一行, 的话回到本行的开头,如果继续输入的话会把先前的覆盖掉

    比如printf("asdflkj 111")输出的是111flkj

  • 相关阅读:
    Node.js :HTTP请求和响应流程
    Node.js :URL、QueryString介绍
    jQuery
    如何angular过滤器进行排序???
    封装jsonp
    原生js的math对象
    Iscrool下拉刷新
    javascript闭包
    javascript对象(3)
    javascript对象(2)
  • 原文地址:https://www.cnblogs.com/oxspirt/p/9927884.html
Copyright © 2020-2023  润新知