C语言 #define 和 typedef 区别
C语言题库
共 3974字,需浏览 8分钟
· 2022-07-30
typedef的用法
typedef int INT;
typedef (int*) pINT;
typedef unsigned int uint32_t
#define的用法
typedef与#define的区别
typedef (int*) pINT;
typedef的用途
char* pa, pb; //这多数不符合我们的意图,它只声明了一个指向字符变量的指针,和一个字符变量;
typedef char* PCHAR;
PCHAR pa, pb; //同时声明了两个指向字符变量的指针
char *pa, *pb;
struct tagPOINT1
{
int x;
int y;
};
struct tagPOINT1 p1;
tagPOINT1 p1;
typedef struct tagPOINT
{
int x;
int y;
}POINT;
POINT p1; // 这样就比原来的方式少写了一个struct,比较省事,尤其在大量使用的时候
typedef long double REAL;
typedef double REAL;
typedef float REAL;
int *(*a[5])(int, char*);
typedef int *(*pFun)(int, char*);
pFun a[5];
void (*b[10]) (void (*)());
typedef void (*pFunParam)();
typedef void (*pFunx)(pFunParam);
pFunx b[10];
doube(*)() (*e)[9];
typedef double(*pFuny)();
typedef pFuny (*pFunParamy)[9];
pFunParamy e;
int (*func)(int *p);
int (*func[5])(int *);
typedef的陷阱
typedef char* PSTR;
int mystrcmp(const PSTR, const PSTR);
typedef static int INT2; //不可行
评论
Define Word
Lookupdefinitionoftextusingaconfigurablelistofsearchengines;pre-configuredwith15commonchoices.Locali
Define Word
0
C 和 C++ 中指针和地址的区别
在C语言和C++中,指针是非常重要的一部分,程序的执行过程中可以通过指针来找到要操作的数据和可执行的函数代码。很多人就明白指针和地址是有区别的,但是很少有人能说清楚这种区别。
指针总共可以分为两种,函数指...
QS6626643650ac9b127
0