array in objective c

后端 未结 4 2034
盖世英雄少女心
盖世英雄少女心 2021-01-07 08:22

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         


        
相关标签:
4条回答
  • 2021-01-07 08:34

    You can use this code

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

    May this will help you..

    0 讨论(0)
  • 2021-01-07 08:43

    Fixed that for you:

    for (i=0; i<sizeof(anBray)/sizeof(int); i++) {
       NSLog(@ " anBray[%d]= %d ",i,anBray[i]); 
     }
    
    0 讨论(0)
  • 2021-01-07 08:43

    Change NSLog(@ " anBray[i]= %i ",anBray[i],anBray[i]); to NSLog(@ " anBray[%i]= %i ",i,anBray[i]);

    0 讨论(0)
  • 2021-01-07 08:49
    for (i=0; i<sizeof(anBray)/sizeof(int); i++)
        NSLog(@ " anBray[%d]= %i ",i,anBray[i]); 
    
    0 讨论(0)
提交回复
热议问题