Skip to main content

Posts

Showing posts with the label c program to compare two strings using pointers

C Program To Compare Two Strings With/Without Using strcmp() Function.

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");    ...