Objective C Boolean Array

前端 未结 6 993
北恋
北恋 2020-12-08 18:54

I need to utilize an array of booleans in objective-c. I\'ve got it mostly set up, but the compiler throws a warning at the following statement:

[updated_use         


        
6条回答
  •  星月不相逢
    2020-12-08 19:28

    Like Georg said, use a C-array.

    BOOL myArray[10];
    
    for (int i = 0; i < 10; i++){
      myArray[i] = NO;
    }
    
    if (myArray[2]){
       //do things;
    }
    

    Martijn, "myArray" is the name you use, "array" in georg's example.

提交回复
热议问题