目标c中的数组 [英] array in objective c

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

问题描述

我对如何在NSLOg声明下增加订单表示怀疑。
,例如我的代码是

i have doubt in how to increase the order under NSLOg statement. for e.g my code is

 int anBray[ ] = {0,5, 89, 34,9,189,9,18,9 34,89, 34,2,600,-2,0};

 int i;    

NSLog (@"Input:");

     for (i=0; i<sizeof(anBray)/sizeof(int); i++)
    NSLog(@ " anBray[i]= %i ",anBray[i]); 

实际上我得到了输出 - :

actually i am getting the output-:

                               anBray[i]=0                               
                               anBray[i]=5
                               anBray[i]=89.....and so on.

但我怎么能得到这样的输出 - :

but how can i get output like this-:

                                 anBray[0]=0
                                 anBray[1]=5
                                 anBray[2]=89....and so on.

请任何人帮助我谢谢...

please any one help me thanks...

推荐答案

修正了你:

for (i=0; i<sizeof(anBray)/sizeof(int); i++) {
   NSLog(@ " anBray[%d]= %d ",i,anBray[i]); 
 }

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

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