Hello friends!!!!!
To compare two strings
C LANGUAGE
11/19/20241 min read
// To compare two strings
#include <stdio.h>
#include<string.h>
int main() {
char a[50] = "Rishendra";
char b[50] = "Rishendra";
// strcmp - To compare the two strings given
if(strcmp(a , b) == 0) {
printf("Both the strings are equal.");
}
else{
printf("Both are not same");
}
}
Output:
Both the strings are equal.
=== Code Execution Successful ===