C Program - Compare strings



#include <stdio.h>
#include <conio.h>
#include <string.h>

int main()
{
    char a[100], b[100];

    printf("Enter the first string\n");
    gets(a);

    printf("Enter the second string\n");
    gets(b);
    /*strcmp(string, string) : returns 0 if strings are equal else strings are unequal*/
    if( strcmp(a,b) == 0 )
        printf("Entered strings are equal.\n");
    else
        printf("Entered strings are not equal.\n");
   
    getch();
    return 0;
}

Output
----------

Comments

Popular posts from this blog

Introduction to C++ Programming Language

The Assembly Process Of 8086 Microprocessor-Two Pass Assembling Steps

Installing 8086 Assembler on a Computer