C Program To Compare Two Strings Using strcmp Function #include <stdio.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); 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 Compare Enter the second string Compare Entered strings are equal. C Program To Compare Two Strings Without Using strcmp Function #include <stdio.h> int compare_strings(char [], char []); int main() { int flag; char a[1000], b[1000]; printf("Input first string\n"); gets(a); printf("Input second string\n"); ...
All HR and Technical interview questions with answers for freshers and experienced professional. It helps job seekers who are about to attend interviews.