Protection Status

C program to compare the two strings || C Program

Code -

#include <stdio.h> 
int main()  
 char str1[20];  // declaration of char array 
 char str2[20];  // declaration of char array 
 int value; // declaration of integer variable 
   printf("Enter the first string : ");  
   printf("Enter the second string : ");  
 // comparing both the strings using strcmp() function 
   printf("strings are same");  
   printf("strings are not same");  
 return 0;  

Output -

Enter the first string sam
Enter the second string sam
strings are same

3 views0 comments

Related Posts

See All

Program of Random Number in C || C Programs

Code - #include <stdio.h> #include <conio.h> #include <stdlib.h> void main() { // use rand() function to generate the number printf (" The random number is: %d", rand()); pri

Getchar() function in C || C Programs

Code - #include <stdio.h> #include <conio.h> void main() { char c; printf ("\n Enter a character \n"); c = getchar(); // get a single character printf(" You have passed ")

  • Facebook
  • Instagram
  • LinkedIn
  • 1024px-Telegram_logo.svg
  • download
  • YouTube
  • Google Play