Substring in C++ is achieved using str::substr() which is a predefined function comes with string.h header file. This function basically takes two arguments pos and len. In this function the index starts from 0.
A substring is a part of a string. A function to obtain a substring in C++ is substr(). This function contains two parameters: pos and len. The pos parameter specifies the start position of the substring and len denotes the number of characters in a substring.