C examples for String:Compare
Compare two strings using strcmp function
#include <stdio.h> #include <string.h> int main(void) { char str1[] = "The quick brown fox"; char str2[] = "The quick black fox"; if (strcmp(str1, str2) > 0) printf("str1 is greater than str2.\n"); else/* w w w .j a v a 2s. co m*/ printf("str1 is less than str2.\n"); return 0; }