#include <iostream>
#include <cstring>
using namespace std;
namespace space1{
int sp1_a=10;
}
namespace space2{
int sp2_a=20;
namespace space3{
struct person{
int id;
char name[10];
};
}
}
int main(){
using namespace space1;
cout<<sp1_a<<endl;
using namespace space2::space3;
struct person p={1,"nihaomaz"};
cout<<"id: "<<p.id<<" name: "<<p.name<<endl;
char data[10];
std::strcpy(data,p.name);
cout<<"data: "<<data<<endl;
system("pause");
return 0;
}
来源:CSDN
作者:从前,有个傻子........
链接:https://blog.csdn.net/weixin_41377572/article/details/104199183