What I need to do is to put the first n of second string input behind first string input .And every string may have blank space which I donot know how to set formatted input. I try to do it like this.BUT wrong output.
void fun(char *s1, char *s2, int n){
int l = strlen(s1);
for(int i=0;i<n;i++){
s1[l+i]=s2[i];}
}
int main(){
char s1[10];char s2[10]; int n;
scanf("%s\n",s1);
scanf("%[^\n]",s2);
scanf("%d",&n);
fun(s1,s2,n);
printf("%s",s1);
return 0;
}
The output example:
hello
my bro
3
hellomy @