d3dx939dll

Aula51 - Strings IV

Jan 31st, 2021 (edited)
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void){
  4.  
  5.     _Bool stringsIguais(char s1[], char s2[]);
  6.  
  7.     if(stringsIguais("casa", "casa")){
  8.         printf("Sao Iguais\n");
  9.  
  10.     } else{
  11.         printf("Nao sao Iguais\n");
  12.  
  13.     }
  14.  
  15.     return 0;
  16. }
  17. _Bool stringsIguais(char s1[], char s2[]){
  18.     int i = 0;
  19.  
  20.     while(s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0'){
  21.         ++i;
  22.     }
  23.     if(s1[i] == '\0' && s2[i] == '\0'){
  24.         return 1;
  25.     } else{
  26.         return 0;
  27.     }
  28.  
  29. }
  30. //Sobre
  31.  
  32. //Aula: Verificar Igualdade Entre Duas Strings (#51)
  33. //Data: 31/01/2021
  34. //Grupo: /r/heikoa
  35.  
  36. //Referencia:
  37.  
  38. //Video: youtube.com/watch?v=sOT6n8JTX-U
Add Comment
Please, Sign In to add comment