scc

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

0015-strcpy.c (316B)


      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 *s, buf[40];
     16 
     17 	puts("testing");
     18 
     19 	s = strcpy(buf, "test");
     20 	assert(s == buf);
     21 	assert(!strcmp(s, "test"));
     22 
     23 	s = strcpy(buf, "");
     24 	assert(s == buf);
     25 	assert(!strcmp(s, ""));
     26 
     27 	puts("done");
     28 
     29 	return 0;
     30 }