c语言 11-6

1、

#include <stdio.h>

char *mach(char *s, int key)
{
    while(*s)
    {
        if(*s == key)
            return s;
        s++;
    }
    return NULL;
}

int main(void)
{
    char str[128];
    printf("str: "); scanf("%s", str);
    
    printf("result: %s
", mach(str, 'c'));
    return 0;    
} 

原文地址:https://www.cnblogs.com/liujiaxin2018/p/14843058.html