10 February 2022

Function - strcmp()

 


#include<stdio.h>
#include<string.h>
 
int main()
{
    char *name = "Nandu";
    char *name1 = "Chandu";

    int value = strcmp(name, name1);
    printf("Now the value is %d", value);

    // This function is used to compare two strings.
    // It returns 0 : if strings are equal.
    // Negative Value : If first string's missmatching character's
    // ASCII value is not greater than sencond string's corresponding
    // mismatching character.
    // It returns positive value otherwise...

return 0;
}

OUTPUT-->

Now the value is 1

No comments:

Post a Comment