New people for help!!!!!!
Here is my code, if there is a problem where hope bosses can point to,
# include & lt; Iostream>
using namespace std;
Int the Insert (char * dest, char * SRC, int pos);
Char * S1, S2.
Int main (int arg c, char * argv [])
{
Char [80] s1 and s2 [80].
Int n, len;
S1=S1;
S2=S2;
Cout & lt; <"Dest:";
Cin & gt;> S1.
Cout & lt; <"SRC";
Cin & gt;> S2.
Cout & lt; <"Pos:";
Cin & gt;> n;
Len=Insert (S1, S2, n); Write://in the complete program calls the Insert function,
Cout & lt; <"The output:" & lt;return 0;
}
Int the Insert (char * dest, char * SRC, int pos)
{
int i, j;
Char \ [80].
\ [0]='} ';
For (I=pos, j=1; i <=strlen (dest); I++ j++)
[j]=temp dest [I];
Dest (pos)=123;
For (I=0, j=pos + 1; i <=strlen (SRC) - 1; I++ j++)
Dest [j]=SRC [I];
Dest [j + 1)='\ 0';
Strcat (dest, temp);
S1=dest;
Return strlen (dest);
}
CodePudding user response:
Dest [j + 1)='\ 0'; To dest [j]='\ 0';//note for circulation after the location of j j, so dest [j]='\ 0'; Is correct, dest [m + 1] can cause dest [j] is a garbage characters, so will the codeCodePudding user response: