summaryrefslogtreecommitdiff
path: root/memcmp.c
blob: e9ad5b7f38086b5d5d3b4cfc6ae7741690effe6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
#include <string.h>

int main()
{
  char str1[5] = "test";
  char str2[5] = {'t', 'e', 's', 't', '\0'};

  if (memcmp(str1, str2, 5*sizeof(char)) == 0) {
    printf("str1とstr2は同じです。\n");
  } else {
    printf("str1とstr2は異なります。\n");
  }
  // => str1とstr2は同じです。
}