[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
QbasicFAQ_WhyQBasic » cpplexicalcast » VESA » jpg » MsDosSet » software » D » dynamic » CppBuilderGlossary » QbasicFAQ_Mouse » CMemcmp
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
QbasicFAQ_WhyQBasic » cpplexicalcast » VESA » jpg » MsDosSet » software » D » dynamic » CppBuilderGlossary » QbasicFAQ_Mouse » CMemcmp
(C) memcmp
C function for comparing two buffers (of type char*).int main () { char str1[] = "Sentence 1"; char str2[] = "Sentence 2"; int length1 = strlen(str1); int length2 = strlen(str2); int comparison = memcmp (str1, str2, max(length1,length2)); if (comparison>0) { sprintf("str1 is greater than str2"); } else if (comparison<0) { sprintf("str1 is less than str2"); } else { sprintf("str1 is equal to str2"); } return 0; }
- include <stdio.h>
- include <string.h>
'memcmp' links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
