//在你的代码里做了修改和说明,欢迎交流
#include
#include
using namespace std;
struct node
{
int x,y;
};
//node a,b[100];
int main()
{
//a=(node) {1,2};
node a = {1,2};//用大号括号进行初始化,只能在定义变量的时候
node b[100];
for(int i = 0; i<100; i++)
memcpy(&b[i],&a,sizeof(b));//这里前两个参数都应该是地址
}
a就是个普通变量,{1,2}算怎么回事?
数组也是指针的一种,不过又不能完全算是指针