Advertisement
mario_mos

strcmp

Jul 24th, 2023
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. #include <string.h>
  6. int main()
  7. {
  8.  
  9.  
  10. char ch1 [10];
  11. strcat(ch1,"bonjour");
  12. char ch2 [10];
  13. strcat(ch2,"gilles");
  14.  
  15.  
  16. printf("1ere Valeur de strcmp(): %d\n",
  17. strcmp(ch1, ch2));
  18. strcat(ch1,"gilles");
  19. strcat(ch2,"bonjour");
  20. printf("2eme Valeur de strcmp(): %d\n",
  21. strcmp(ch1, ch2));
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. return 0;
  29. }
  30.  
  31. /*
  32. 1ere Valeur de strcmp(): -5
  33. 2eme Valeur de strcmp(): 8
  34. 14:20:46: /home/mariomoser/C_learning_journey/build-exemple_1-Desktop-Debug/exemple_1 exited with code 0
  35. */
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement