strcmp() library function Example

How to write a program in strcmp() library function in C programming ?

Solution:
#include<stdio.h>
int mystrcmp(char str1[],char str2[]);
int main(void)
{
    char s1[999999];
    char s2[999999];
    gets(s1);
    gets(s2);
    int x=mystrcmp(s1,s2);
    printf("%d",x);
    return 0;
}
int mystrcmp(char str1[],char str2[])
{
    int i;
    for(i=0;str1[i]!='\0';i++)
    {

    }

    int j;
    for(j=0;str2[j]!='\0';j++)
    {

    }

    if(i>j)
    {
        return 1;
    }
    else if(i<j)
    {
        return -1;
    }
    else
    {
        return 0;
    }
}


Learn More :