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 /memcpy.c | |
parent | 1d810e685c5d97426bf6fe07d879a8cddd7b5743 (diff) |
wip
Diffstat (limited to 'memcpy.c')
-rw-r--r-- | memcpy.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/memcpy.c b/memcpy.c new file mode 100644 index 0000000..2131ef6 --- /dev/null +++ b/memcpy.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include <string.h> + +int main() +{ + char str1[10] = "Hi johnny"; + char str2[10] = {0}; + if (memcpy(str2, str1, strlen(str1))) { + printf("コピー元: %s\nコピー先: %s\n", str1, str2); + // コピー元: Hi johnny + // コピー先: Hi johnny + } else { + fprintf(stderr, "Error while coping str1 into str2.\n"); + } +} |