gpt4 book ai didi

c++ - 使用c++的数据结构

转载 作者:太空宇宙 更新时间:2023-11-03 10:21:05 25 4
gpt4 key购买 nike

如果我们有一个指针数组,即

struct node*ptr[];

如果我们想用 null 初始化它的第一个索引 (ptr[0]) 的值,那么我们该怎么做呢?

最佳答案

如果您希望能够初始化ptr[0],您必须为您的数组指定一个固定大小(例如struct node *ptr[1])或分配内存(struct node *ptr[] = new node *;

关于c++ - 使用c++的数据结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4851087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com