scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

0031-memmove.c (329B)


      1 #include <assert.h>
      2 #include <stdio.h>
      3 #include <string.h>
      4 
      5 /*
      6 output:
      7 testing
      8 done
      9 end:
     10 */
     11 
     12 int
     13 main()
     14 {
     15 	char buf[30];
     16 
     17 	puts("testing");
     18 
     19 	memcpy(buf, "abcdef", 6);
     20 	assert(!memcmp(memmove(buf, buf+3, 3), "def", 3));
     21 	memcpy(buf, "abcdef", 6);
     22 	assert(!memcmp(memmove(buf, buf+3, 0), "abc", 3));
     23 
     24 	puts("done");
     25 
     26 	return 0;
     27 }