In this section, you will learn how to get the substring from a string in C. You can see in the given example, a string and a method substring() is created. Inside the method, we have declared the variables i and j to select the part of the string in order to get the substring. On calling the method substring(6,19,ch), you will get the substring from the specified string. Here 6 and 19 are the starting and ending index values of the string.
Here is the code:
Output will be displayed as:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: February 6, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles