बिजनेस मार्केटिंग का लो कॉस्ट फंडा , अपने मोबाइल से ऑटो sms भेजकर मार्केटिंग करे विजिट करे http://autotextsms.com/ बिजनेस मार्केटिंग का लो कॉस्ट फंडा http://autotextsms.com/

Search This Blog

Translate

c program to accept a string and insert at specific location of another string

c program to insert at specific,c program to insert an element in an array,c program to insert an element in an array using pointers,c program to insert an element in an array using function,c program to insert an element in an array at desired position,c program to insert a character in a string,c program to insert a node in linked list,c program to insert and delete an element in an array,write a c program to insert an element in an array


c program to accept a string and insert at specific location of another string


#include
#include
void sinsert(char s1[], char s2[],int loc);
void main()
{
  int loc;
  char s1[20],s2[20];
  clrscr();
  printf("\n Enter string:");
  scanf("%s",s1);
  printf("\n Enter the location:");
  scanf("%d",&loc);
  printf("\n Enter the new string:");
  scanf("%s",s2);
  sinsert(s1,s2,loc);
  getch();
}
void sinsert(char s1[],char s2[],int loc)
{   int i,j;
    char temp[20];
  for(i=loc-1,j=0;s2[j]!='\0';i++,j++)
  {   temp[j]=s1[i];
      s1[i]=s2[j];
  }
   s1[i]='\0';
  for(i=strlen(s1),j=0;temp[j]!='\0';i++,j++)
     s1[i]=temp[j];
  s1[i]='\0';
  printf("%s",s1);

 }



c program to insert at specific,c program to insert an element in an array,c program to insert an element in an array using pointers,c program to insert an element in an array using function,c program to insert an element in an array at desired position,c program to insert a character in a string,c program to insert a node in linked list,c program to insert and delete an element in an array,write a c program to insert an element in an array

C Program example List