diff options
author | haturatu <taro@eyes4you.org> | 2024-12-12 19:39:56 +0900 |
---|---|---|
committer | haturatu <taro@eyes4you.org> | 2024-12-12 19:39:56 +0900 |
commit | 9ed0c06de64b7bd6f5390c4f5972ac0578c0f858 (patch) | |
tree | 6ad61ca8f1f5a4375620313bf863a95d232d6a66 /memcmp.c | |
parent | 1d810e685c5d97426bf6fe07d879a8cddd7b5743 (diff) |
wip
Diffstat (limited to 'memcmp.c')
-rw-r--r-- | memcmp.c | 15 |
1 files changed, 15 insertions, 0 deletions
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 <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は同じです。 +} |