scc

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

0013-strcmp.c (387B)


      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 	puts("testing");
     16 
     17 	assert(strcmp("abcd", "abcd") == 0);
     18 	assert(strcmp("abcd", "a") > 0);
     19 	assert(strcmp("a", "abcd") < 0);
     20 	assert(strcmp("aa", "ab") < 0);
     21 	assert(strcmp("ab", "aa") > 0);
     22 	assert(strcmp("", "a") < 0);
     23 	assert(strcmp("a", "") > 0);
     24 
     25 	puts("done");
     26 
     27 	return 0;
     28 }