summaryrefslogtreecommitdiff
path: root/memmove.c
diff options
context:
space:
mode:
Diffstat (limited to 'memmove.c')
-rw-r--r--memmove.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/memmove.c b/memmove.c
new file mode 100644
index 0000000..f766ad0
--- /dev/null
+++ b/memmove.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+ char str[20] = "abc,def";
+
+ printf("memmove()実行前\n");
+ printf("%s\n", str);
+ /// => abc,def
+
+ if (memmove(str+4, str, strlen(str))) {
+ printf("memmove()実行後\n");
+ printf("%s\n", str);
+ // => abc,abc,def
+ } else {
+ fprintf(stderr, "エラー発生\n");
+ }
+}