Advertisement
Deepak_Bhatta_KAji

strcmp Function in C

Apr 14th, 2023
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. char Yname[20]="Deepak";
  6. char Fname[20]="deepak";
  7.  
  8. int count;
  9. count=strcmp(Yname,Fname);
  10.  
  11. if(count==0)
  12. {
  13. printf("\nBoth the strings %s and %s are equal",Yname,Fname);
  14. }
  15. else if(count>0)
  16. {
  17. printf("\nThe first strings %s is greater than second %s",Yname,Fname);
  18. }
  19. else
  20. {
  21. printf("\nThe first strings %s is less than second %s",Yname,Fname);
  22. }
  23. return 0;
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement