




下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
字符串處理函數(shù)介原型:externintbcmp(constvoid*s1,constvoid*s2,int用法:#includes1s2的前n//#include{char*s2="Goldenglobal printf("s1equaltos2in7bytes");printf("s1notequaltos2in7printf("s1equaltos2in12bytes");printf("s1notequaltos2in12return0;}原型:externvoidbcopy(constvoid*src,void*destint用法:#include//#include{chard[20]; printf("s:printf("d: //bcopyignorenullinstringreturn0;}原型:externvoidbzero(void*s,int用法:#include說明:bzero無返回值。//#include{{inta;floatf;}char //structinitializationtozeroprintf("Initailreturn0;}原型:externvoid y(void*dest,void*src,unsignedcharch,unsignedint用法:#includech則停止NULL。ch被。// #include{chard[20],*p; { printf("Charfound:%s.\n",d);}printf("Charnotreturn0;}原型:externvoid*memchr(void*buf,charch,unsigned用法:#includeNULL//#include{char*p;printf("Notreturn0;} 原型:externintmemcmp(void*buf1,void*buf2,unsignedint用法:#includebuf1和buf2count
當(dāng)buf1<buf2時,返回值<0當(dāng)buf1=buf2時,返回值=0當(dāng)buf1>buf2時,返回值//#include{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanreturn0;}原型:externvoid*memcpy(void*dest,void*src,unsignedint用法:#include功能:由src所指內(nèi)存區(qū)域count個字節(jié)到dest所指內(nèi)存區(qū)域。//#include{chard[20];return0;} 原型:externintmemicmp(void*buf1,void*buf2,unsignedint用法:#includebuf1和buf2count個字節(jié)但不區(qū)分字母的大小寫。說明:memicmp同memcmp的唯一區(qū)別是memicmp不區(qū)分大小寫字母。當(dāng)buf1<buf2時,返回值<0當(dāng)buf1=buf2時,返回值=0當(dāng)buf1>buf2時,返回值//#include{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanreturn0;}原型:externvoid*memmove(void*dest,constvoid*src,unsignedint用法:#include//#include{return0;} 原型:externvoid*memset(void*buffer,intc,int用法:#include說明:返回指向buffer的指針。//#include{return0;}原型:extern原型:externvoidmovmem(void*src,void*dest,unsignedint用法:#include//#include{movmem(s,s+7,strlen(s)-s[strlen(s)-return0;}原型:externvoidsetmem(void*buf,unsignedintcount,char用法:#include說明:返回指向buf的指針。//#include{return0;}原型:externchar*stpcpy(char*dest,char用法:#include返回指向dest結(jié)尾處字符(NULL)的指針。//#include{chard[20];return0;}原型:externchar*strcat(char*dest,char用法:#include返回指向dest的指針。//#include{char*s="View";return0;}原型:externchar*strchr(char*s,char用法:#include//#include{char*p;printf("Notreturn0;}原型:externintstrcmp(char*s1,char*用法:#include//#include{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanreturn0;}原型:externintstricmp(char*s1,char*用法:#include當(dāng)s1<s2時,返回值<0//#include{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanreturn0;}原型:externchar*strcpy(char*dest,char用法:#include返回指向dest的指針。//#include{chard[20];return0;} 用法:#include//#include{char*r="new";intn;printf("Thecharbothins1ands2is:return0;}原型:externchar*strdup(char用法:#include//#include{char*d;return0;} 原型:externintstrlen(char用法:#include//#include{printf("%shas%dreturn0;}原型:externchar*strlwr(char用法:#include//#include{return0;}原型:externchar*strncat(char*dest,char*src,int用法:#includesrc所指字符串的前n個字符添加到dest結(jié)尾處(覆蓋dest結(jié)尾處的'\0')并添加'\0'。//#include{chard[20]="GoldenGlobal";return0;}原型:externintstrcmp(char*s1,char*s2,int用法:#includes1s2的前n個字符。//strncmp.c#include<string.h>{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanprintf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthans2");return}原型:externintstrnicmp(char*s1,char*s2,int用法:#includes1s2的前n個字符但不區(qū)分大小寫。說明:strncmpi是到strnicmp的宏定義//#include{char*s1="o,Programmers!";char*s2="o,programmers!";intr;printf("s1ands2areidentical");printf("s1lessthans2");printf("s1greaterthanreturn0;}原型:externchar*strncpy(char*dest,char*src,int用法:#include
srcnNULLNULL字符結(jié)束。src和dest所指內(nèi)存區(qū)域不可以且dest必須有足夠的空間來容納src的字符串。返回指向dest的指針。//#include{char*s="GoldenGlobalchar*d="o,GGVProgrammers";char*p=strdup(s); //enable6linesreturn0;} 原型:externchar*strpbrk(char*s1,char用法:#include//#include{char*s1=" char*s2="BIT";printf("Notprintf("Notreturn0;}原型:externchar*strrev(char用法:#includeNULL//#include{ eTo //6linesperscreenreturn0;}原型:externchar*strset(char*schar用法:#include說明:返回指向s的指針。//#include{return0;}原型:externchar*strstr(char*haystack,char用法:#include說明:返回指向第一次出現(xiàn)needle位置的指針,如果沒找到則返回NULL。//#include{char*l="lob";charprintf("Notreturn0;}
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 幫助考生的監(jiān)理工程師試題及答案
- 學(xué)術(shù)論文投資咨詢工程師試題及答案
- 完善備考育嬰師考試試題及答案清單
- 全方位支持的陪診師考試試題及答案
- 動物行為矯正初步試題及答案
- 2024年人力資源管理師考前資料試題及答案
- 黑龍江省七臺河市重點中學(xué)2024-2025學(xué)年高三下第11次大練習(xí)英語試題含解析
- 傳感器與檢測技術(shù)課件 項目一識別與選用傳感器1.1 識別傳感器
- 黑龍江省哈爾濱三十二中2025屆高三歷史試題周練試卷含解析
- 黑龍江省哈爾濱市尚志市達(dá)標(biāo)名校2025年初三中考沖刺壓軸卷(一)化學(xué)試題含解析
- 澳大利亞PSC檢查經(jīng)過
- 01-14江蘇大學(xué)車輛工程考研復(fù)試真題答案
- TMYZX 001-2021 釀酒專用小麥原糧
- 2023年湖北國土資源職業(yè)學(xué)院高職單招(數(shù)學(xué))試題庫含答案解析
- GB/T 37910.1-2019焊縫無損檢測射線檢測驗收等級第1部分:鋼、鎳、鈦及其合金
- 雷鋒叔叔你在哪里教學(xué)反思
- (新版)國家統(tǒng)計執(zhí)法證資格考試備考題庫(含答案)
- 項目驗收單標(biāo)準(zhǔn)模板
- 24式太極拳教案(1~4課)
- 小學(xué) 三年級 心理健康《最好的老師-興趣的作用》教學(xué)設(shè)計
- DB12T 1040-2021 建筑工程規(guī)劃管理技術(shù)規(guī)范
評論
0/150
提交評論