Advertisement
Jodyone

ptr

Oct 28th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 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.     // establish a ponter and point to period
  8.     char * ptr = strrchr(extention,'.');
  9.     // advance ptr untill ' '
  10.     for (char*i = ptr; *i != ' '; i++)
  11.     {
  12.         // store what ever ptr is pointing at in extention
  13.         strncpy(array,ptr,1);   //  only printing '.' doesnt seem to be advancing the loop ?
  14.     }                            
  15.     printf("%s\n",extention );
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement