Personal C-language learning route

Source: Internet
Author: User
Tags strcmp

In-depth study of C language, must know each C language library function implementation principle and function, otherwise in the use of the time is easy to make mistakes, and even do not know where the error. Understand the implementation method and function of each library function, plus the algorithm.

For example, the string handler function strcmp, comparing the size between two strings, is case-sensitive.

Implementation of the STRCMP function (not unique):

/*strcmp function*/ #include <string.h> I int (strap)( const char *sl, const char *s2) {      /*compare unsigned char sl[],s2[]*/      for (;*sl==*s2;++sl,++s2)          if (*sl== ‘\0‘ )              return (0);      return ((*(unsignedchar*)sl<*(unsignedchar*)s2)?-1:+1); }

This function does not implement finding another string in an existing string, and if a pointer is found that returns a matching substring, no return null pointer is found. Need to use strncmp function, only understand each function's implementation method, can use flexibly.

Data structure is essential, will not write can check information, master ideas, encountered any problems can also use this method. Would not write not terribly, a master of one.

This article is from the "Learning, Fools" blog, please be sure to keep this source http://pizilong.blog.51cto.com/1283400/1620734

Personal C-language learning route

Related Article

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.