From 9ed0c06de64b7bd6f5390c4f5972ac0578c0f858 Mon Sep 17 00:00:00 2001 From: haturatu Date: Thu, 12 Dec 2024 19:39:56 +0900 Subject: wip --- memcpy.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 memcpy.c (limited to 'memcpy.c') 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 +#include + +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"); + } +} -- cgit v1.2.3