Is there a function to get a substring from a certain place in a char array with a certain length?
i know there is the function strncpy or memcpy but this functions only do a substring from first letter to another letter.
Post a Reply
|Oldest Newest Rating|
· May 2, 2015
Functions which require a char *ptr parameter means a pointer to a character, not necessarily the beginning of an array. You can manipulate the position of the pointer within an array and start from there, then limit the number of characters you want to access. Here is an example:
· May 1, 2015
So, let me test my understanding. You want a function that copies a substring from a starting character to an ending character.
char* substring(char* haystack,char start, char end);
Those are the parameters you would take in this function?
I don't think such a function exists, but you could easily make one.
One of the most popular languages of all time.
|Bucky Roberts Administrator|