2
@interface GameState :NSObject{
int SymbolsPositions[3][5];
}
-(void)SaveCurrentGameState:(int **)Array;
@end
@interface GameViewController : UIViewController
{
...
int sequence_after_spin[3][5];
...
}
-(Void)AMethod;
@end
.m文件
@implementation GameState
-(void)SaveCurrentGameState:(int **)Array
{
for(int i = 0;i<5;i++)
for(int j = 0;j<3;j++)
NSLog(@" %d",Array[j][i]);
}
@end
@implimentation GameViewController
-(void)AMethod
{
[instanceOfGameState SaveCurrentGameState:sequence_after_spin];
}
@end
當過amethod方法被調用的iget應用程序崩潰以下警告
warning: incompatible pointer types sending 'int [10][5]' to parameter of type 'int **' [-pedantic]
也添加崩潰日誌。崩潰可能是由於不同的原因。 –
'int **'和'(* int)[5]'是不一樣的 – user102008