#include
Void main () {
Char a [10]={' s', 'a', 'w'}, b [10]={' g ', 'w', 'f'};
int i;
For (I=strlen (a) + 1; i<10; I++) {
A [I]=[I - b strlen (a)];
}
For (I=0; i<10; I++) {
Printf (" % c ", a [I]);
}
printf("\n");
}
CodePudding user response:
a=b [I] [I - strlen (a) - 1].
You began value b [1], so will not output 'g'
CodePudding user response:
Char a [10]={' s', 'a', 'w'};//put the remaining seven compiler to 0, a first="saw"Char [10] b={' g ', 'w', 'f'};//b="GWF
"int i;
//
For (I=strlen (a); i<10; I++)//so strlen here is legal (a)
CodePudding user response:
Note thatPrintf (" % c ", 0);//="a"
Use the
Printf (" % 02 x, 0).//="00"
CodePudding user response:
Learn to debug itThe debugged and so many great god knew the problem was incredibly so hard to answer
CodePudding user response:
For (I=strlen (a) + 1; i<10; I++) {//strlen (a)=3, 4 you start is wrong, don't + 1A [I]=[I - b strlen (a)];
}
CodePudding user response:
In addition, the char a [10]={' s', 'a', 'w'}, b [10]={' g ', 'w', 'f'}; This definition to changeChar a [10]={' s', 'a', 'w', 0}, b [10]={' g ', 'w', 'f', 0};