Wisdom Materials
Home
About Us
Our Clients
Careers
Services
Education
Jobs
News
Business
Health
Astrology
Entertainment
RealEstate
Devotion
Contact Us
C Programs
/ Sub string insertion in main string C Program
Program
Click to the Copy Program
#include
#include
void main() { int position; char str[20],str1[20],str2[20]=""; printf("Enter string1\n"); scanf("%s",str); printf("Enter string2\n"); scanf("%s",str1); printf(" Enter position to substring in main String: \n"); scanf("%d",&position); strncpy(str2,str,position); strcat(str2,str1); strcat(str2,str+position); puts(str2); }
Input
Enter string1: wisdom
Enter string2: materials
Enter position to substring in main String: 5
Output
wisdomaterialsm
Home
Back