Home > Back-end >  String concatenation function by programming the strcat function, connect string t to the tail end o
String concatenation function by programming the strcat function, connect string t to the tail end o

Time:10-24

# include

Void strcen (char * s, char * t);

Void main ()
{
Char a []="abcde";
Char [b]="fghi";
Strcen (a, b);
Printf (" % s \ n ", a);
}

Void strcen (char * s, char * t)
{
int i,j;
For (I=0; S [I]!='\ 0'; I++)
;
For (j=0; T [j].='\ 0'; J++)
S [j] [I + j]=t;
S [I + j]='\ 0';
}



The following graphic error window appears after the program is running, trouble ask the great spirit, what was wrong with my application?

CodePudding user response:

Connect the array a overflow, changing a [] to [10] a.
  • Related