关于const问题?
#include<iostream>using namespace std;
int main(){
struct s
{
int i,j;
};
const s str[]={1,2,3,4};
cout<<str[0]<<endl<<str[1]<<endl; //这句为什么不能输出?是因为 上面的const?为什么
getchar();
return 0;
}
const 一般被编译器放在符号表中. 那这符号表又是什么?是否占空间
2008-10-01 22:08
2008-10-01 22:10

2008-10-01 22:22
程序代码:
#include<iostream>
using namespace std;
struct s
{
int i,j;
};
ostream& operator<<(ostream& out, const s& _s)
{
cout <<_s.i << "\t" << _s.j << "\t" << flush;
return out;
}
int main()
{
const s str[]={1,2,3,4};
cout << str[0] << endl << str[1] << endl; //这句为什么不能输出?是因为 上面的const?为什么
getchar();
return 0;
}

2008-10-01 22:25
2008-10-01 22:32
2008-10-01 23:07

2008-10-01 23:15
2008-10-01 23:20
2008-10-01 23:26
2008-10-01 23:29