两种定义方法——the nineth——2022.12.30

C语言中一共有两种定义变量的方法:

1. 宏定义:再#include下面紧跟#define

例如:


 

#include <stdio.h>

#define SUN_FLOWER 100;

#define IPHONE_14 6200;


 

2.CONST INT定义

例如:

#include <stdio.h>

int main()

{

const int IPHONE_14 = 6200;  //定义变量的时候,变量名称一般都是大写。

return 0;

}

 

posted @ 2022-12-30 19:29  江理第一深情  阅读(34)  评论(0)    收藏  举报