C-programming - String compare in c, C program to compare strings
String compare in c
This c program compares two strings using strcmp function.#include<stdio.h> #include<string.h> main() { char a[100], b[100]; printf("Enter the first string\n"); gets(a); printf("Enter the second string\n"); gets(b); if( strcmp(a,b) == 0 ) printf("Entered strings are equal.\n"); else printf("Entered strings are not equal.\n"); return 0; }
output
Enter the first string hello Enter the second string hello Entered strings are equal.
The topic on C-programming - String compare in c is posted by - Sandhya
Hope you have enjoyed, C-programming - String compare in cThanks for your time