#define ARR_SIZE sizeof(arr)/ sizeof(arr [0]) [英] #define ARR_SIZE sizeof(arr)/sizeof(arr[0])

查看:202
本文介绍了#define ARR_SIZE sizeof(arr)/ sizeof(arr [0])的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码没有打印出原因为什么?

代码是正确的。 plz解释逻辑


#include< stdio.h>


int arr [] = {10,20,30,40, 50};


#define ARR_SIZE sizeof(arr)/ sizeof(arr [0])


void main()

{

for(int i = -1; i<(ARR_SIZE-1);)

printf(" Hello%d \ n" ,arr [++ i]);

}

谢谢&问候

Vinu

解决方案

" Vinu" < 6 ********* @ yahoo.com>写道:

以下代码没有打印出原因为什么?
代码是正确的。




你所展示的代码至少在两个方面是不正确的;并且没有

要求Usenet上的作业答案。


HTH;手。


Richard


Vinu< vi ********* @ yahoo.com>写道:

for(int i = -1; i<(ARR_SIZE-1);)




提示:通常的算术转换。


-

Stan Tobias

mailx`echo si *** @FamOuS.BedBuG.pAlS.INVA LID | sed s / [[:upper:]] // g`


查看专家C程序,深层C分泌答案。


The following code doesn''t prints anything why it is?
The code is correct. plz explain the logic

#include <stdio.h>

int arr[] = {10,20,30,40,50};

#define ARR_SIZE sizeof(arr)/sizeof(arr[0])

void main()
{
for(int i= -1; i < (ARR_SIZE-1); )
printf("Hello %d\n", arr[++i]);
}
Thanks & Regards
Vinu

解决方案

"Vinu" <vi*********@yahoo.com> wrote:

The following code doesn''t prints anything why it is?
The code is correct.



The code you showed is not correct, in at least two aspects; and neither
is asking for homework answers on Usenet.

HTH; HAND.

Richard


Vinu <vi*********@yahoo.com> wrote:

for(int i= -1; i < (ARR_SIZE-1); )



Hint: Usual Arithmetic Conversions.

--
Stan Tobias
mailx `echo si***@FamOuS.BedBuG.pAlS.INVALID | sed s/[[:upper:]]//g`


see the Expert C ProgramIng , deep C secretes for the answer.


这篇关于#define ARR_SIZE sizeof(arr)/ sizeof(arr [0])的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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