Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void subStr(char *src, char *out, int part) { /* subStr is a function that copies the "part"
- substring of src to out and returns out's
- address -- "parts" are strings seperated by spaces */
- int i = 0, j = 0;
- while(part > 1) {
- while(*(src + i++) != ' ') {} // cycle through bytes of src
- part--; // decrease "part" by one for every space found
- } // here we have reached the string we want to copy
- while((*(src + i) != ' ') || (*(src + i) != '\0')) // copy till next space or end of string
- *(out + j++) = *(src + i++);
- *(out + j) = '\0';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement