const
#include<stdio.h>
int main()
{
const int a = 200;
const int* p1 = &a;
int* const p2 = &a;
int const* const p3 = &a;
return 0;
}
typedef
#include<stdio.h>
typedef unsigned int UINT;
typedef int* AA;
typedef int ARR[5];
int main()
{
UINT a = 127;
UINT b = 128;
printf("%d %d\n",a,b);
int* p1, p2;
AA p3, p4;
ARR arr1;
return 0;
}
宏
#include<stdio.h>
#define AA printf("hello")
#define PINT int*
typedef int BOOL;
#define TURE 1
#define FALSE 0
int main()
{
AA;
PINT a, b;
return 0;
}
有参数的宏
#include<stdio.h>
#define ADD(a,b) a + b
#define MUL(a,b) (a)*(b)
#define lenth(a) sizeof(a)/sizeof(a[0])
int main()
{
int arr[10];
char arr1[7];
printf("%d\n",ADD(1, 2));
printf("%d\n",MUL(1 + 1, 2 + 2));
printf("%d\n",lenth(arr));
printf("%d\n", lenth(arr1));
return 0;
}