第29348题 单选题
关于以下C++代码中字符数组与指针的内存分配,下列说法正确的是?

阅读以下C++代码片段:

#include <iostream>
#include <cstring>
using namespace std;

int main() {
    char a[] = "hello";
    char* b = new char[6];
    strcpy(b, "world");
    const char* c = "cpp";
    return 0;
}

下列关于这段代码的内存分配描述正确的是?

{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析