C++基础 -4- C/C++混合编程

发布时间 2023-12-12 08:46:26作者: 日落悬崖

———————C/C++混合编程———————

?引用格式(图片+代码段)

 

extern "C"
{
    #include "string.h"
}

  

?代码验证 (分别使用了C++/C 的标准输出)

 

#include "iostream"

using namespace std;

extern "C"
{
#include "stdio.h"
#include "string.h"
}

int main()
{
    int a = 100;
    int b = 200;
    cout << a << endl;
    printf("%d\n", b);
}

  ———————End———————