Topic RequirementsWrite a C-language program simulation to implement the STRCMP function.(We still simulate the implementation of the STRCMP function, and then against the String.h library in the implementation of the STRCMP function, compared with
Conversion from: Implementation and explanation of strcmp Functions
The strcmp function is a basic function in C/C ++. It compares two strings and returns the comparison result. The function form is as follows:Int strcmp (constchar * str1,
(i) strcmp function The strcmp function compares the size of two strings and returns the result of a comparison. The general form is: I=STRCMP (String, string); where string 1, string 2 can be either a string constant or a variable, and I is an
Implementation of C + + Common library function atoi,itoa,strcpy,strcmpC-language string manipulation functions1. String reversal-Strrev2. String copy-strcpy3. String conversion to integer-atoi4. String Length-strlen5. String connection-strcat6.
Start with the question:Strcmp () anyone?
Time limit:2000 ms
Memory limit:0 KB
64bit Io format:% LLD & % llusubmit status
Description
J
? Strcmp ()? Anyone?Input:Standard InputOutput:Standard output
Strcmp () is a library
//strcat (DEST,SRC) adds the string src refers to at the end of the Dest (overwrites the ' + ' at the end of the dest) and adds ' % 'Char*strcat (Char* Strdest,Const Char*strsrc) { Char*res=strdest; Assert ((strdest!=null) && (strsrc!=NULL));
strcmp and strncmp are used to compare strings, and the difference is whether the specified length string can be compared. strcmp
C + + functions, comparing two stringsSet these two strings as STR1,STR2,If STR1==STR2, return 0;If str1 > str2, return
The simulation implements the memory comparison function memcmp:The function is similar to strcmp, and can be used for the same string comparison, and returns a value of 0 if the same. If the former is greater than the latter, an integer value
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.