/* * C and pointer. In chapter 6, the first question is to find the characters that appear in a specific character set. Basic Idea: match the first character of any character in the Chars string in source. */ # Include <Stdio. h> # Include <Stdlib. h> Char Const * Find_char ( Char Const * Source, Char Const * Charz ){ Int A = 0 ; Char Const * Src = Source; Char String = * SRC; While ( String ! = ' \ 0 ' ){ Char Const * Chars =Charz; For (; * Chars! = ' \ 0 ' ;){ If (* Chars ++! = String ) Continue ; Else { = 1 ; Break ;}} If (A = 1 ){ Return SRC ;} Else { String = * ++ SRC ;}} Return NULL ;} Int Main ( Void ){ Char Source [ 100 ]; Char Chars [ 100 ]; Char Const * SRC; printf ( " Enter a source string: \ n " ); Gets (source ); While ( 1 ) {Printf ( " Enter a search string: \ n " ); Gets (chars); SRC = Find_char (source, chars ); If (Src = Null) {printf ( " Matching failed !! : \ N " ); Continue ;} Printf ( " Matched !! : \ N " ); Printf ( " % C " ,* SRC ); While (* ++ SRC! = ' \ 0 ' ) Printf ( " % C " ,* SRC); printf ( " \ N " );} Return 0 ;}