如何获取指针数组中的元素数量? [英] How to get number of elements in array of pointers?

查看:400
本文介绍了如何获取指针数组中的元素数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何获取指针数组中的元素数量?


下面是我的代码。

 struct 

{

int a;

char ch [10];

int;

} mystruct;

mystruct * m_arr [2];



解决方案

您好,


您知道设置m_arr时的元素数量,例如 当您使用  new(因为你必须给出保留记忆的数字)。


或者你如何设置m_arr?


问候,Guido


Hi,

How to get number of elements in array of pointers?

below is my code.

struct 

{

int a;

char ch[10];

int ;

} mystruct;

mystruct *m_arr[2];


解决方案

Hello,

you know the number of elements when you set m_arr, e.g. when you use new (because you must give the number to reserve memory).

Or how do you set m_arr?

Regards, Guido


这篇关于如何获取指针数组中的元素数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆