Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char *devide(char *str, char ch)
- {
- char *strpos = str;
- char* newStr;
- while (*strpos != '\0' && *strpos != ch) {
- ++strpos;
- }
- if (*strpos == '\0')
- printf("%c was not found in string", ch);
- newStr = (char*)malloc((strlen(strpos) + 1) * sizeof(char));
- if (!newStr)
- return NULL;
- strcpy(newStr, strpos);
- return newStr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement