/*Write a C program that uses functions to perform the following operation :To insert a sub-string in to a given main string from a given position.
*/
#include<stdio.h>
#include<conio.h>
#incldue<string.h>
main()
{
char a[100],b[100];
int i,j;
int p
clrscr();
printf("\n Enter the Main String");
gets(a);
printf("\n Enter the sub string");
gets(b);
Printf("\n Enter the position in main string where the substring has to be substituted");
scanf("%d",&p);
for(i=p,j=0;j<=n;j++,i++)
{
a[i]=b[j];
}
a[i]='\0';
printf("\n The main String after insertion of substring is\n");
printf("%s",a);
getch();
}
*/
#include<stdio.h>
#include<conio.h>
#incldue<string.h>
main()
{
char a[100],b[100];
int i,j;
int p
clrscr();
printf("\n Enter the Main String");
gets(a);
printf("\n Enter the sub string");
gets(b);
Printf("\n Enter the position in main string where the substring has to be substituted");
scanf("%d",&p);
for(i=p,j=0;j<=n;j++,i++)
{
a[i]=b[j];
}
a[i]='\0';
printf("\n The main String after insertion of substring is\n");
printf("%s",a);
getch();
}
No comments:
Post a Comment