Chinaunix首页 | 论坛 | 博客
  • 博客访问: 532745
  • 博文数量: 150
  • 博客积分: 5010
  • 博客等级: 大校
  • 技术积分: 1861
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-17 00:19
文章分类

全部博文(150)

文章存档

2011年(1)

2009年(14)

2008年(135)

我的朋友

分类: LINUX

2008-08-22 10:49:40

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]才是:!

太低级的错误了
阅读(3164) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~