/*
============================================================================
Name : C-Programming
Author : Code2care
Version : 1.0
Copyright : Code2care.org
Description : 104 : Compare two entered strings are same or not using strcmp() function.
============================================================================
*/
#include
#include
int main(void) {
char str1[100], str2[100];
int i = 0, res;
printf("Enter a string A : ");
scanf("%s", str1);
printf("Enter a string B : ");
scanf("%s", str2);
if (strcmp(str1, str2) == 0) {
printf("\nBoth strings are same");
}
else {
printf("Both strings are NOT same");
}
return 0;
}
The best way to learn C programming is to practice more and more of programs .
Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.