Advertisement
Jodyone

strchr.c

Oct 28th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main (void)
  5. {
  6.     char extention[] = "this string.css file";
  7.     char* ptr = strchr(extention,'.');
  8.     printf("%s\n",extention);
  9.         char* needle = strrchr(extention,' ');
  10.     char array[needle - ptr + 1];
  11.     strncpy(array,ptr,needle - ptr);
  12.  
  13.  
  14.     printf("%s\n",array);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement