![]() |
VOOZH | about |
In C++, character arrays are used to store sequences of characters also known as strings. A substring is a part of a string that consists of a continuous sequence of characters from the string. In this article, we will learn how to extract a substring from a character array in C++.
To extract a substring from a character array in C++ follow the below approach:
The following program illustrates how we can extract a substring from a character array in C++:
String: Geeks for Geeks Substring: Geeks
Time Complexity: O(N) where N is the length of the character array.
Auxiliary Space: O(N)