<分区>
#include <bits/stdc++.h>
using namespace std;
struct node
{
std::string a;
};
int main()
{
cout << str << endl;
struct node* p = (struct node*)(malloc(sizeof(struct node)));
p->a = "a";
cout << p->a;
return 0;
}
以上代码会产生运行时错误。该结构适用于整数,但当我尝试使用字符串作为其成员变量时,会发生错误。它还会在 codechef ide 上给出运行时错误。