如何测量数组的大小 [英] how to measure size of an array

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

问题描述

有人能说出如何在不使用

sizeof运算符的情况下测量数组的大小吗?

Can anyone tell how to measure the size of an array without use of
sizeof operator ?

推荐答案

" asit dhal" < pe ******** @ gmail.comwrites:
"asit dhal" <pe********@gmail.comwrites:

任何人都可以告诉如何在不使用
的情况下测量数组的大小
sizeof运营商?
Can anyone tell how to measure the size of an array without use of
sizeof operator ?



如果在过去几个讨论同样蹩脚问题的几个月内参考其中一个线程,而不是开始

a新线程?

-

int main(void){char p [] =" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\

\ n",* q =" kl BIcNBFr.NKEzjwCIxNJC" ;; int i = sizeof p / 2; char * strchr(); int putchar(\

); while( * q){i + = strchr(p,* q ++) - p; if(i> =(int)sizeof p)i- = sizeof p-1; putchar(p [i] \

);}返回0;}

How about referring to one of the many threads in the last few
months that discuss this same lame question, instead of starting
a new thread?
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}


2月14日上午9:02,asit dhal < penasit ... @ gmail.comwrote:
On Feb 14, 9:02 am, "asit dhal" <penasit...@gmail.comwrote:

任何人都可以告诉如何在不使用

sizeof的情况下测量数组的大小运营商?
Can anyone tell how to measure the size of an array without use of
sizeof operator ?



大小信息在数组声明时给出。当一个

数组传递给一个函数时,sizeof无法评估函数内部数组的大小。

The size information is given at declaration of an array. When an
array is passed into a function, the sizeof can''t evaluate the size of
the array inside the function.


asit dhal:
asit dhal:

任何人都可以告诉如何在不使用
$ b $的情况下测量数组的大小b sizeof运营商?
Can anyone tell how to measure the size of an array without use of
sizeof operator ?



(char *)pover - (char *)p


-

~ / JB \〜


(char*)pover - (char*)p

--
~/JB\~


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

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