warning: assignment makes pointer from integer without a cast

iOS 码拜 9年前 (2015-05-09) 1186次浏览 0个评论
 

以下红色代码报警告:warning: assignment makes pointer from integer without a cast
我虽然看懂英文但是刚刚搞iphone开发,小弟实在期待高手直接给出修改方法啊!

        char *pwdArray[4][4];
int bacCode =(int) [password substringToIndex:1]; ; // 取密码后二位
int preCode =(int) [password substringFromIndex:2]; // 取密码前二位

int checksum1 = 0;
int checksum2 = 0;

bacCode <<= 1;
preCode <<= 1;

for (int y = 0; y < 2; y++) {
for (int x = 0; x < 4; x++) {
pwdArray[1 – y][3 – x] = (char) (preCode & 0x1); // 0x1 16进制 为1
checksum1 ^= preCode & 0x1;
preCode >>= 1;

pwdArray[3 – y][3 – x] = (char) (bacCode & 0x1);
checksum2 ^= bacCode & 0x1;
bacCode >>= 1;
[[NSString alloc] initWithFormat:@”%d”, y];

/*
NSLog(@”*******************”);
NSLog([[NSString alloc] initWithFormat:@”%d”, y]);
NSLog([[NSString alloc] initWithFormat:@”%d”, x]);

NSLog([[NSString alloc] initWithFormat:@”%d”, checksum1]);
NSLog([[NSString alloc] initWithFormat:@”%d”, checksum2]);
NSLog(@”*******************”);
 */
}
}

pwdArray[1][3] = (char) checksum1;
pwdArray[3][3] = (char) checksum2;

20分
char *pwdArray[4][4];改成char pwdArray[4][4];
20分
改成char pwdArray[4][4]就好了
你的那段代码就不是objC的,几乎全是c++的东西
也就是说得多看下指针的东西了

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明warning: assignment makes pointer from integer without a cast
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!