Description:
In this program we need to insert a string into another string from a
specified position.
Algorithm:
Step 1: start
Step 2: read main string and sub string Step 3: find the length of main
string(r) Step 4: find length of sub string(n)
Step 5: copy main string into sub string
Step 6: read the position to insert the sub string( p)
Step 7: copy sub string into main string from position p-1
Step 8: copy temporary string into main string from position p+n-1
Step 9: print the strings
Step 10: stop
Output:
1.enter first string: computer
2.enter second string: get
3.enter the position where the item has to be inserted:3 comgetputer
Conclusion :
The program is error free
VIVA QUESTIONS:
1) What is string ?
Ans: A string is an collection of characters
2) Which command is used to combined the two strings ?
Ans: Strcat()
3) Which command is used to copy the strings ?
Ans: strcpy() function copies one string to another
Algorithm
No comments:
Post a Comment