..

FreePrograms


  CONTACT US   ABOUT US   PRIVACY  DISCLAIMER

FREE C PROGRAMS 

What is C C vs C++ vs Java Program Structure Data Types in C Basic Rules of C & C++
Functions in C If, Else Conditions Loops in C Switch Case Arrays
Pointers Structures in C Strings in C Command Line Arguments Type Casting
Linked Lists Recursion Binary Trees Inheritance Multiple Inheritance
Templates File I/O Object Oriented Programming Data Structures in C C interview Questions

C programming Tutorial : Free C Programs, C Programs Download

....

Strcmp function is used to compare two strings

Use of Strcmp Function

#include<stdio.h>

#include<string.h>

void main(void)

{

char str1[31],str2[31];

int value;

printf("\n Enter string 1");

gets(str1);

printf("Enter Second String");

gets(str2);

value=strcmp(str1,str2);

if(value>0)

printf("string %s comes after %s in dictionary order\n"str1,str1);

else if(value<0)

printf("string %s comes before %s in dictionary order\n"str1,str2);

else

printf("Both Strings are same\n");

}

COPYRIGHT 2009 ALL RIGHTS RESERVED FREECPROGRAMS.COM