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
5 Years
Discussion Span
Last Post by deceptikon
-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 topic 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.