0
#include <stdio.h>
#include <stdlib.h>
void main()
{
    char str[30],str1[30],str2[50];
    int i,n,j,k;
    printf("enter the string: ");
    fgets(str,sizeof(str),stdin);
    printf("enter the inserting string: ");
    fgets(str1,sizeof(str1),stdin);
    printf("enter the position: ");
    scanf("%d",n);
    for(i=0,k=0;i<n;i++,k++)

        str2[k]=str[i];
        for(j=0;str1[j]!='\0';j++,k++)
        str2[k]=str[j];
        for(i=n;str[i]!='\0';i++,k++)
        str[k]=str[i];
        printf("%s",str);
}

no errors for example output will be like this
enter the string:rohinnj
enter the inserting string:kumar
enter the position to be inserted:5
the inserted string is:rohinnkumarj

2
Contributors
4
Replies
5
Views
4 Years
Discussion Span
Last Post by deceptikon
Featured Replies
  • 1

    If you don't bother to read my replies then I'm going to stop trying to help you. How do I know you aren't reading my replies? Because if you were, then you'd realise that I already answered this one with [another post on a similar topic](http://www.daniweb.com/software-development/c/threads/429137/replacing-a-string-in-string#post1837477). Read More

  • 1

    I'm more than happy to explain anything about my posts, so please don't be afraid to ask for clarification. If you stay quiet, I'll just assume that you understood and expect you to apply that understanding in future posts. Read More

-1

hey deceptikon its not like that i didnt read ur replies bcoz some times its difficult to follow ur answers(it means i didnt understand what ur replying).i dont particularly mention u .and iam bit shy to ask the questions regularly

1

I'm more than happy to explain anything about my posts, so please don't be afraid to ask for clarification. If you stay quiet, I'll just assume that you understood and expect you to apply that understanding in future posts.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.