美文网首页
import和include

import和include

作者: MarkTang | 来源:发表于2016-01-09 00:34 被阅读39次
    //
    //  main.m
    //  #import
    //
    //  Created by zyz on 15/12/7.
    //  Copyright (c) 2015年 zyz. All rights reserved.
    //
    
    //import 的功能和 include一样,是将右边的文件拷贝到当前的import的位置
    //为了降低程序员的负担,防止重复导入,避免程序员取书写,头文件卫士,那么OC给出来一个新的预处理指令import
    //import优点:会自动防止重复导入
    //Foundation.h主头文件,主头文件又拷贝了该工具箱所有的头文件,我们只需要导入一个主文件,避免每次都要导入对应的头文件
    //所有的主头文件名字都和工具箱的名字相同
    //只要导入主头文件就导入了工具箱所有的头文件
    #import <Foundation/Foundation.h>
    #include <stdio.h>
    int main(int argc, const char * argv[]) {
        //会自动换行 会在前面附加一点系统信息  和pringtf接受的参数不一样
        NSLog(@"objective-c hello world");
        //不会自动换行
        printf("c hello world");
        
        return 0;
    }
    

    相关文章

      网友评论

          本文标题:import和include

          本文链接:https://www.haomeiwen.com/subject/pyxqkttx.html