#ifndef #end #endif都是什么,C语言

来源:百度知道 编辑:UC知道 时间:2024/06/16 13:53:09
#ifndef WIN32
#include <sys/socket.h>
#include <netinet/in.h>
#else
#include <winsock.h>
#endif

这代码是什么意思

#ifndef #end #endif都是什么意思

#ifndef WIN32 //如果没有定义win32
#include <sys/socket.h> //包含这个头文件
#include <netinet/in.h>
#else //如果定义了win32
#include <winsock.h> //包含这个
#endif //条件编译结束
那三个都是用来条件编译的

ifndef=if not define如果没有定义,则....
endif=end if IF语句结束

预编译语句

自己看看吧