In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use string processing functions in C language, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article.
Strlen:1. Counter version: # include#include#includeint my_strlen (const char * str) {int count = 0; assert (stringed blocks null); while (* stringed boxes'\ 0') {count++; str++;} return count;} 2. Recursive version int my_strlen (const char * str) {assert (str! = NULL); if (* str = ='\ 0') return 0; return (my_strlen (+ + str) + 1);} 3. Pointer-pointer version int my_strlen (const char * str) {char * end = str; assert (stringing null); assert (endpoints null); while (* endpoints ='\ 0') {end++;} return end-str;} strcat:#include#include#includechar * my_strcat (char * dest,char * str) {char * ret=dest;// first address assert (dest&&str) While (* dest) {dest++;} while (* dest++=*str++); dest=ret; return dest;} strcmp:int my_strcmp (char * str1, char * str2) {assert (str1&&str2) While (* str1==*str2) {if (str1=='\ 0diagnostic str2 examples) return 0; str1++; str2++;} if (* str1 > * str2) return 1; return-1; / / or return str1-str2 } Thank you for reading this article carefully. I hope the article "how to use string processing functions in C language" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.