Wisdom Materials
Home
About Us
Our Clients
Careers
Services
Education
Jobs
News
Business
Health
Astrology
Entertainment
RealEstate
Devotion
Contact Us
C Programs
/ To delete n characters from a given position in a given string.
Program
Click to the Copy Program
#include
#include
void main() { char str[20],str2[20]=""; int delnchars,position; printf("Enter a string: "); scanf("%s",str); printf("Enter a position: "); scanf("%d",&position); printf("Enter number of characters to be delete: "); scanf("%d",&delnchars); strncpy(str2,str,position); strcat(str2,str+position+delnchars); puts(str2); }
Input
Enter a string: wisdomabcdmaterials
Enter a position: 6
Enter number of characters to be delete: 4
Output
wisdommaterials
Home
Back