test.c:40: warning: passing arg 1 of `sprintf' makes pointer from integer without a cast
test.c:46:
warning: passing arg 1 of `strlen' makes pointer from integer without a cast
是这样的,我定义了一个二维字符数组:
char bluetooth_info[5][20] = { '\0' };
在用strlen() sprintf()时,
1
while( pch != NULL )
sprintf( bluetooth_info[index++][20] , "%s" , pch );
|
2
if( strlen( bluetooth_info[2][20] ) == 0 )
{ printf( "can not find device \n" );
return;
}
|
正确的使用应是:
sprintf( bluetooth_info[index++], "%s" , pch );
strlen( bluetooth_info[2])
没有[20]才是:!
太低级的错误了
阅读(3224) | 评论(0) | 转发(0) |