C and pointer (pointers on C) -- Chapter 6: pointer (ii) exercises

Source: Internet
Author: User

It is difficult for the author to answer the first three questions!

Please see http://download.csdn.net/download/wangpegasus/5701765

1,

 
Char * find_char (char const * Source, char const * chars) {char * PTR; If (source! = NULL & chars! = NULL) {for (; * Source! = '\ 0'; source ++) {for (PTR = (char *) chars; * PTR! = '\ 0'; PTR ++) {If (* PTR = * Source) {return (char *) Source ;}}} return NULL ;}
2,

Char * match (char * string, char * sub) {While (* sub! = '\ 0') {string ++; sub ++; If (* string! = * Sub) {return NULL;} return string;} int del_substr (char * STR, char const * substr) {char * PTR; PTR = NULL; if (STR = NULL & substr = NULL) {return 0 ;}for (; * Str! = '\ 0'; STR ++) {PTR = match (STR, (char *) substr); If (PTR! = NULL) {break;} while (* STR ++ = * PTR ++) {;} return 1 ;}
3,

 
Void reverse_string (char * string) {char temp; char * last; last = string; If (string! = NULL) {While (* last! = '\ 0') {last ++;} Last --; while (string> last) {temp = * last; * Last = * string; * string = temp; string --; last ++ ;}}}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.