#include<stdio.h> main() { char blog1[50],blog2[50]; printf("Enter string 1.\n"); scanf("%s",blog1); printf("Enter string 2.\n"); scanf("%s",blog2); printf("Strcmp Output - %d",strcmp(blog1,blog2)); // This compares the string stored in blog1 with string stored in blog2 // If ASCII value of 1st element of Blog1 is greater than AScii value of 1st element of Blog2 // then 1 is printed, in vice versa case we get -1 // And if both have the same ascii value it moves to checking of ASCII value of 2nd element stored // in both, if all values come out to be equal then it returns 0. }
Continue reading “Function Strcmp”