首页 > 其他 > 详细

memcmp和strcmp差别

时间:2020-09-13 15:07:43      阅读:66      评论:0      收藏:0      [点我收藏+]

            

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>

static char usbcmd[] = {0x11,0,13,0,15};
static char recevecmd[] = {0x11,0,13,14,15};
//memcmp int memcmp(const void *str1, const void *str2, size_t n)

int main()
{
    //
    char ret = memcmp(usbcmd,recevecmd,5);
    printf("ret memcmp is %d\n",ret);
    ret = strcmp(usbcmd,recevecmd);
    printf("ret strcmp is %d\n",ret);

    for(;;);
    return 0;
}

  技术分享图片

memcmp和strcmp差别

原文:https://www.cnblogs.com/nowroot/p/13660812.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!