美文网首页
struct,enum

struct,enum

作者: 小咕咕coco | 来源:发表于2019-05-24 14:40 被阅读0次

结构

//建立node结构类型
struct node{
    int col;
    int data;
};
struct node a; //声明一个node结构
struct node row[30]; //node结构数组

枚举


//assign continuous integers to variables(to use these variables in the program)

//method 1
#define MON  1
#define TUE  2
#define WED  3
#define THU  4
#define FRI  5
#define SAT  6
#define SUN  7

//method 2
enum am {MON=1,TUE,WED,THU,FRI,SAT,SUN};  //from the first assigned value, accumulate

//difference: in method 2, the varibles still exist after compiling

相关文章

网友评论

      本文标题:struct,enum

      本文链接:https://www.haomeiwen.com/subject/blvgzqtx.html