C和指针c6-1

#include<stdio.h>
#include<stdlib.h> char *find_char(char const *source_str, char const *desc_str); int main(void)
{
char *source_str = "ABCDEF";
char *desc_str = "MMD"; char *c = find_char(source_str, desc_str);
if(c != NULL)
{
printf("%c\n", *c);
}
else
{
printf("IS NULL!\n");
} return EXIT_SUCCESS;
} char *find_char(char const *source_str, char const *desc_str)
{
if( (source_str == NULL) || (desc_str == NULL) )
{
return NULL;
} int i = ;
while(*desc_str != '\0')
{
while(*source_str != '\0')
{
if(*desc_str == *source_str)
{
char c = *source_str;
char *d = &c;
return d;
}
source_str++;
i++;
}
desc_str++;
source_str -= i;//将source_str的指针置位
i = ;
} return NULL;
}
上一篇:Android对ScrollView滚动监听,实现美团、大众点评的购买悬浮效果


下一篇:JVM探秘5---JVM监控命令大全