Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. int sprpoczatek(char *buf, char* slowo){
  2. int h=strlen(slowo);
  3. for(int i=0; i<h; i++)
  4. if(buf[i]!=slowo[i])
  5. return 0;
  6. if(buf[strlen(slowo)]!=' ')
  7. return 0;
  8. return 1;
  9. }
  10.  
  11. int sprkoniec( char* buf, char*slowo){
  12. if(strlen(buf)>1){
  13. if((buf[strlen(buf) - strlen(slowo)-1])!=' '){
  14. printf("%c\n", buf[1]);
  15. return 0;
  16. }
  17. for(int i=0; i<(strlen(buf) - strlen(slowo)); i++)
  18. if(buf[strlen(buf)+i-strlen(slowo)] != slowo[i])
  19. return 0;
  20. }
  21. return 1;
  22. }
  23.  
  24.  
  25. char *case1 = malloc(sizeof(char) * (strlen(skorowidz.slowa[i])+3));
  26. char *case2 = malloc(sizeof(char) * (strlen(skorowidz.slowa[i])+3));
  27. strcpy(case1, " ");
  28. strcpy(case1, skorowidz.slowa[i]);
  29. strcat(case1, " ");
  30. char *temp_copy = skorowidz.slowa[i];
  31. if( (strstr( buf, case1 ) != NULL) || (sprpoczatek(buf,skorowidz.slowa[i]) == 1) /*|| (sprkoniec(buf, skorowidz.slowa[i])==1)*/)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement