Redian新闻
>
[美少女外拍动作图解×100].黑面 新增 mega链接
avatar
[美少女外拍动作图解×100].黑面 新增 mega链接# PhotoGear - 摄影器材
c*e
1
If an integer array is defined as the following
int* intPtr=new int[100];
How to use the sizeof() function to get the size of the integer array?
avatar
y*i
2
以前拿的是co的卡,合并之后自动转成了united milageplus explorer。还能再拿一次
united的bonus么?
avatar
S*I
4
you can't

【在 c**********e 的大作中提到】
: If an integer array is defined as the following
: int* intPtr=new int[100];
: How to use the sizeof() function to get the size of the integer array?

avatar
o*8
5
看co卡是啥时候开的吧
avatar
n*e
6
sizeof(intPtr)/sizeof(int)
avatar
n*e
7
Forget my last post. It is not correct.
avatar
f*4
8
说个题外话
当你new int[]的时候,那个内存区域应该有地方标记了内存范围,或者是元素个数吧
?不然的话delete[]怎么才能释放正确的内存范围呢?

【在 S**I 的大作中提到】
: you can't
avatar
S*I
9
yes, but that's implementation defined, there is no portable way to get the
size of a dynamically allocated array.

【在 f****4 的大作中提到】
: 说个题外话
: 当你new int[]的时候,那个内存区域应该有地方标记了内存范围,或者是元素个数吧
: ?不然的话delete[]怎么才能释放正确的内存范围呢?

avatar
f*4
10
谢谢,我估计也是没统一的实现的关系

the

【在 S**I 的大作中提到】
: yes, but that's implementation defined, there is no portable way to get the
: size of a dynamically allocated array.

avatar
R*i
11
有记录。
不过sizeof()是编译时运行的函数,所以不能用来得到new 的size。
ref: http://shangshufu.blogspot.com/2011/08/tips-about-sizeof-function-in-c-and-c.html

【在 f****4 的大作中提到】
: 说个题外话
: 当你new int[]的时候,那个内存区域应该有地方标记了内存范围,或者是元素个数吧
: ?不然的话delete[]怎么才能释放正确的内存范围呢?

avatar
b*i
12
sizeof is not a function.
avatar
f*t
13
int array[] = { 1, 2, 3, 4 };
you can get array length by sizeof(array)/sizeof(int)
if the array is dynamically allocated, you can't get its length
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。