Home
       0011-strcat.c - scc - simple c99 compiler
  HTML git clone git://git.simple-cc.org/scc
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
       0011-strcat.c (456B)
       ---
            1 #include <assert.h>
            2 #include <stdio.h>
            3 #include <string.h>
            4 
            5 /*
            6 output:
            7 testing
            8 ok
            9 end:
           10 */
           11 
           12 int
           13 main(void)
           14 {
           15         char *s, buf[40];
           16 
           17         puts("testing");
           18         strcpy(buf, "case1:");
           19         s = strcat(buf, "ok");
           20         assert(s == buf);
           21         assert(!strcmp(s, "case1:ok"));
           22 
           23         strcpy(buf, "");
           24         s = strcat(buf, "ok");
           25         assert(s == buf);
           26         assert(!strcmp(s, "ok"));
           27 
           28         strcpy(buf, "case1:");
           29         strcat(buf, "");
           30         assert(s == buf);
           31         assert(!strcmp(s, "case1:"));
           32 
           33         puts("ok");
           34 
           35         return 0;
           36 }