C开发系列-include

include

在include目录下有两个文件,分别为main.m, abc.txt
main.m内容

#include <stdio.h>
int main(){
    
    #include "abc.txt"
    
    return 0;
}

abc.txt内容

printf("Hello World!!!\n");
printf("Hello World!!!\n");
printf("Hello World!!!\n");

编译、链接main.m,运行结果:

include本质就是完全拷贝的内容。include后面的冒号跟上要拷贝文件的路径,可以是相对路径或者绝对路径。自定义的文件用"",系统自带的文件用

猜你喜欢

转载自www.cnblogs.com/CoderHong/p/9074790.html