我想将一个文件夹的文件的变量访问到另一个文件夹中的文件..我怎么能那样做
I want to access a variable of a file of one folder to the file of another folder....how can i do that?
Eg。我有一个文件1.c在文件夹a和文件2.c在文件夹B
我想将file1.c的变量"I"访问到file2.c中我该怎么做??
您可以通过在file2.c 中对变量进行外部声明来访问file2.c变量中的变量
例如,如果变量i在file1.c 中定义如下
int i = 0;
您可以通过如下声明来访问file2.c中的变量:
extern int i;
只有当它是file1.c 中定义的全局变量时,才能执行此操作
相关文章:
- 如何将更多文件夹添加到c++include路径
- GetShortPathName在网络驱动器上使用中文文件夹时失败
- VS2017,C++包含目录与附加包含目录,子文件夹包含失败-但为什么
- 在 Windows 上,是否可以让 dll 在不使用 PATH 环境变量的情况下在另一个文件夹中查找依赖项?
- 如何在文档文件夹中创建目录
- "assimp/config.h"找不到,但它在文件夹中
- C++入门 5 版:类消息和文件夹
- 我可以在 Arduino 的库文件夹之外安装库吗?
- 如何按文件扩展名引用文件夹中的文件
- 在QTreeView中仅显示共享驱动器和文件夹
- 加载与引用 .NET DLL 位于同一文件夹中的引用的 .NET DLL 时"Not found"异常
- 介子复制/安装头文件到输出目录并保持文件夹结构
- vcruntime.h 从 Windows 包含文件夹中丢失?
- 在文件夹迭代上实现 RAII
- 使用 Powershell 命令将 cpp 文件的文件夹编译为 GNU 的 g++
- 使文件夹中的所有文件可供所有项目(子目录)访问
- 无法使用 CMake 从其他文件夹添加源文件
- 如何在安卓工作室中将c ++头文件从一个文件夹导入到另一个文件夹?
- 对单元测试(googletest)和项目/文件夹/文件的混淆
- 设计文件夹/文件系统