|
|
发表于 2005-4-25 11:27:15
|
显示全部楼层
Post by jovesky
代码如下:
#include<stdio.h>
#define TRUE 1
#define FALSE 0
int find_char( char **strings,char value)
{
char *string;
while( (string = *strings++) != '\0')
{
while( *string++ = '\0')
{
if( *string == value)
return TRUE;
}
}
return FALSE;
}
int main( void )
{
int b;
char c = 'q';
char *a[] = {"abc","defg","hijqz"};
char **d = a;
b = find_char( d, c );//问题所在
printf( "b = %d\n",b );
}
问题是:编译通过,但是执行就提示段错误。问题应该是在注释的那句,但是我不知道为什么错了,是不是参数传递有问题啊,应该怎么传送第一个参数呢?
how can you compare a string and a char
&
think about what *strings++ means |
|