From 9ed0c06de64b7bd6f5390c4f5972ac0578c0f858 Mon Sep 17 00:00:00 2001 From: haturatu Date: Thu, 12 Dec 2024 19:39:56 +0900 Subject: wip --- memcmp.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 memcmp.c (limited to 'memcmp.c') diff --git a/memcmp.c b/memcmp.c new file mode 100644 index 0000000..e9ad5b7 --- /dev/null +++ b/memcmp.c @@ -0,0 +1,15 @@ +#include +#include + +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は同じです。 +} -- cgit v1.2.3