#include <stdio.h>
//宏定义
#define N 1
//结构体类型 用于代表一个多类型的集合
struct student
{
int no;
double score;
char sex;
};
//枚举类型
//本质上是宏定义的集合
enum operation
{
//默认会从0开始赋值
HIGH,
MIDDLE,
LOW
};
//联合体 可以在相同内存空间大小 转换存储内容类型
union _item
{
int no;
char ch[4];
};
int main(void)
{
/* c 中的基本变量类型 */
//所有的c中的基本变量之前 都会略写一个关键字
//默认情况下 所有的基本类型都是有符号变量
//所以系统自动分配内存的变量 默认都有auto修饰
//因为没有任何实际意义,所以大部分情况下略写
unsigned int i; //无符号整形
auto double d; //double类型不可以用unsigned和signed修饰
static char c; //静态变量
const short s; //只读变量
volatile float f; //注:系统编程时使用的共享变量
signed long l; //有符号长类型
register long double ld; //注:驱动时使用的寄存器变量
extern long long ll; //只用于声明的全局变量
//结构体变量
struct student stu;
//联合体变量
union _item item;
//枚举不需要生成变量
HIGH;
return 0;
}
//宏定义
#define N 1
//结构体类型 用于代表一个多类型的集合
struct student
{
int no;
double score;
char sex;
};
//枚举类型
//本质上是宏定义的集合
enum operation
{
//默认会从0开始赋值
HIGH,
MIDDLE,
LOW
};
//联合体 可以在相同内存空间大小 转换存储内容类型
union _item
{
int no;
char ch[4];
};
int main(void)
{
/* c 中的基本变量类型 */
//所有的c中的基本变量之前 都会略写一个关键字
//默认情况下 所有的基本类型都是有符号变量
//所以系统自动分配内存的变量 默认都有auto修饰
//因为没有任何实际意义,所以大部分情况下略写
unsigned int i; //无符号整形
auto double d; //double类型不可以用unsigned和signed修饰
static char c; //静态变量
const short s; //只读变量
volatile float f; //注:系统编程时使用的共享变量
signed long l; //有符号长类型
register long double ld; //注:驱动时使用的寄存器变量
extern long long ll; //只用于声明的全局变量
//结构体变量
struct student stu;
//联合体变量
union _item item;
//枚举不需要生成变量
HIGH;
return 0;
}