我怎样才能代替使用新的使用malloc翻译
How can i instead of using the new use malloc translation
我在 c++ 中用这段代码创建了一个 2D 数组表。
struct person
{
int age;
char name[64];
}
person **p;
p = new person*[256];
如何只翻译部分
p = new person*[256];
使用 MALLOC 到 C 代码。
感谢
p = malloc(256*sizeof(*p));
for(size_t i=0; i< 256; i++)
{
p[i] = malloc(sizeof(**p));
}
不要忘记广告代码,如果 mallocs 没有失败,则检查。
相关文章:
- 如果没有malloc,链表实现将失败
- 不同翻译单元中不可重载的非内联函数定义
- malloc() 可能出现内存泄漏
- Cuda C++:设备上的Malloc类,并用来自主机的数据填充它
- 当我尝试加载内核模块时,如何修复C++中的这个 malloc() 错误?
- 需要将一行代码从C++ Qt翻译成PyQt
- 在C++中创建队列 - 什么是 malloc 错误?
- 如何在 malloc 内存中初始化非 POD 数据
- 为什么未命名的结构内联变量在每个翻译单元中没有相同的地址?
- 使用 malloc() 时出现意外大小
- C++:在被本地字符串捕获后释放或销毁 malloc'd char *?
- 错误:malloc:对象 0x7f9edf504080 的 *** 错误:未分配正在释放的指针
- 将 malloc 替换为数组
- 在没有 API 的情况下使用谷歌翻译文本
- SIGSEGV on Boost UDP 套接字关闭 - tcache_get at malloc.c.
- Malloc 在使用线程并行化 SSH 调用时存在问题
- 如何将新更改为 malloc?
- 如何执行 cppcheck 交叉翻译单元 (CTU) 静态分析?
- 模板变量是否允许在多个翻译单元中并有效合并?
- 我怎样才能代替使用新的使用malloc翻译