memcmp
THINK memory1 - memory2
memcmp("ab", "ac", 2); /* = -1 */
memcmp("abc", "ab", 3); /* = 1 */
memcmp("abc", "abc", 4); /* = 0 */
memcmp
THINK memory1 - memory2
memcmp("ab", "ac", 2); /* = -1 */
memcmp("abc", "ab", 3); /* = 1 */
memcmp("abc", "abc", 4); /* = 0 */
c++ memcmp
/* memcmp example */
#include <stdio.h>
#include <string.h>
int main ()
{
char buffer1[] = "DWgaOtP12df0";
char buffer2[] = "DWGAOTP12DF0";
int n;
n=memcmp ( buffer1, buffer2, sizeof(buffer1) );
if (n>0) printf ("'%s' is greater than '%s'.\n",buffer1,buffer2);
else if (n<0) printf ("'%s' is less than '%s'.\n",buffer1,buffer2);
else printf ("'%s' is the same as '%s'.\n",buffer1,buffer2);
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us