oc-03-OC访问OC源文件、C源文件中的函数

show.h

#ifndef __OCDay01__Show__
#define __OCDay01__Show__

#include <stdio.h>

extern void testTshow();


#endif /* defined(__OCDay01__Show__) */

 show.c

#include "Show.h"

void testTshow(){
    printf("我就是大名鼎鼎的 C文件中的 函数 ,何人敢调用?  哈哈哈哈  
");
}

 main.m(oc源文件)

//  6-【理解】访问OC源文件、C源文件中的函数

#import <Foundation/Foundation.h>
//引入 show的头文件
#import "Show.h"
void  test1(){
    printf("你好啊  我是C语言函数  我放在了  OC原文件中 , 你敢调用我一下子  不 ?  哈哈哈  
");
}

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        //OC 中访问 写在OC源文件中的 C语言函数   是可行的. 
        test1();
        //OC 中访问 写在C文件中的 C函数  是可行的.
        testTshow();
    }
    return 0;
}
原文地址:https://www.cnblogs.com/yaowen/p/5304996.html