二级指针的问题,用指针传递函数参数,亲们来看看,解释一下
#include <stdio.h> #include"stdlib.h"
#define TRUE 1
#define FALSE 0
#define LENGTH 10
int find_char( char *strings[], int value)
{
int i=0;
while( strings[i] != NULL)
{
while( *strings[i] != '\0')
{
// printf("func1-%s 2-%s 3-%s\n", strings[0], strings[1],strings[2]);
if( *strings[i]++ == value )
return TRUE;
}
i++;
}
return FALSE;
}
void main()
{
char* str[LENGTH] = {"hello", "world","kkky",NULL};
char ch = 'w';
printf("1- %s 2- %s 3-%s \n", str[0], str[1],str[2]);
if( find_char(str, ch) == TRUE )
{
printf("%c was found!\n", ch);
}
else
{
printf("%c was not found!\n", ch);
}
printf("The string now is \"%s %s %s\"\n", str[0], str[1],str[2]);
system("pause");
}
为什么hello这个字符串不显示呢??????
[此贴子已经被作者于2015-10-19 20:06编辑过]