是否有可能在其他文件中找到其他文件中的变量大小? [英] is it possible to find size of variables in other files which define in another files?
本文介绍了是否有可能在其他文件中找到其他文件中的变量大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的问题:定义了三个.c文件,在两个文件中包含结构变量。另一个文件包含数组变量,其中包含结构变量的名称。
可以找到结构的大小。
Here is my question: three .c file is defined , in two file contains structure variable. And another file having array variable which contains name of structure variables.
it is possible to find size of stucture.
//one.c
void one()
{
struct a{ //define structure in .c file
int al;
char b;
};
typedef struct a a11;
}
//two.c
//define structure variables in .c file
void two()
{
struct a1{
int c1;
};
typedef struct a1 a111;
struct b1{
char c2;
char g;
};
typedef struct a1 a111;
}
这里是另一个文件three.c,
here another file three.c,
void main{
char a[3][10] //two dimmensional array for storing
name of variables.
printf("%d",sizeof(a[0])) ;
}
//存储的结构变量名称;
我的问题是:可以在这个文件中找到a11,a111的大小。
//which stored structure variables name;
my question is: it is possible to find size of a11,a111 in this file.
推荐答案
No。
three.c不知道你在one.c或two.c中隐藏的定义。 怎么可能他们知道?这就是标题的用途。阅读C / C ++标题。
No.
three.c has no knowledge of the definitions you hid in one.c or two.c. How could they know? That is what headers are for. Read up on headers for C/C++.
这篇关于是否有可能在其他文件中找到其他文件中的变量大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文