Advertisement
KaeruCT

main.c

Jan 26th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "str.h"
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.     char *str = "this is a test!";
  7.    
  8.     printf("%s\n", my_strchr(str, 'a'));
  9.    
  10.    
  11.     char *substr = my_substr(str, 0, 9);
  12.     printf("%s\n", substr);
  13.     free(substr);
  14.    
  15.     printf("%s\n", my_strstr(str, "test"));
  16.     printf("%s\n", my_strstr(str, "this"));
  17.    
  18.     char *notfound = my_strstr(str, "unexistent");
  19.    
  20.     if(notfound != NULL){
  21.         printf("%s\n", notfound);
  22.     }
  23.    
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement