Redian新闻
>
什么地方有打折的prada包?
avatar
什么地方有打折的prada包?# Fashion - 美丽时尚
s*A
1
看书上说nonconst variables are extern by default, but to make const variable
accessible to other files we must explicitly specify that it is extern.
这么说的话如果我有两个文件:
//file1.cpp
int a=10;
extern int b=11;
void func(){
extern int c=12;
}
//file2.cpp
#include
int main(){
extern int a,b,c;
std::cout<}
输出会是什么?谢谢!
avatar
c*t
2
要回国了,家里让带一个prada钱包,什么地方有打折的卖?大概多少钱?
能不能顺便推荐几个同档次的
谢谢!
avatar
A*u
3
a=10
b= 11
c没有定义
avatar
N*E
4
woodbury outlet in NY.
Beyondtherack.com, good wallet is sold out 5 minutes after its sales starts
.
avatar
l*8
5
编译不过吧,不能有两个main

variable

【在 s****A 的大作中提到】
: 看书上说nonconst variables are extern by default, but to make const variable
: accessible to other files we must explicitly specify that it is extern.
: 这么说的话如果我有两个文件:
: //file1.cpp
: int a=10;
: extern int b=11;
: void func(){
: extern int c=12;
: }
: //file2.cpp

avatar
s*A
6
sorry,已修改

【在 l*********8 的大作中提到】
: 编译不过吧,不能有两个main
:
: variable

avatar
s*A
7
谢谢
如果在file2.cpp里main函数外再加一个
int a;
这个a会受file1.cpp里的a的值影响吗?

【在 A**u 的大作中提到】
: a=10
: b= 11
: c没有定义

avatar
S*I
8
extern means "defined somewhere else", so your file1.cpp won't compile.
Talking about output from file2.cpp is meaningless.

variable

【在 s****A 的大作中提到】
: 看书上说nonconst variables are extern by default, but to make const variable
: accessible to other files we must explicitly specify that it is extern.
: 这么说的话如果我有两个文件:
: //file1.cpp
: int a=10;
: extern int b=11;
: void func(){
: extern int c=12;
: }
: //file2.cpp

avatar
s*A
9
谢谢,其实我主要是不理解书上的"non const variables are extern by default."这
句话,要是如此的话,non const variable前面加不加extern不都一样吗?总是相当于
有extern

【在 S**I 的大作中提到】
: extern means "defined somewhere else", so your file1.cpp won't compile.
: Talking about output from file2.cpp is meaningless.
:
: variable

avatar
S*I
10
variables can be declared multiple times but can only be defined once. You
can have "extern int a" in multiple files, but you can have only one "int a
= 10" in all files.

【在 s****A 的大作中提到】
: 谢谢,其实我主要是不理解书上的"non const variables are extern by default."这
: 句话,要是如此的话,non const variable前面加不加extern不都一样吗?总是相当于
: 有extern

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。