My code as follows, can use a N tries in cb, platform show operation error, which a great god help me to look at what is going wrong,,
#include
#include
Int main ()
{
int i=0;
Char a, [5].
A [I]=getchar ();
While (a [I]! )
='\ n'{
i++;
A [I]=getchar ();
}
Printf (" % d \ n ", I);
for(int j=0; J{
Printf (" % d ", a [j] - 48).
}
Printf (" % d \ n ", a] [I - 1-48).
For (int j=I - 1; J>=0; J -)
{
Printf (" % d ", a [j] - 48).
}
}
CodePudding user response:
# include & lt; Stdio. H>
#include
Int main ()
{
int i=0;
//char a, [5].
Char a, [16].
A [I]=getchar ();
While (a [I]! )
='\ n'{
i++;
If (I & gt; 5) {
Printf (" big! \n");
return 0;
}
A [I]=getchar ();
}
Printf (" % d \ n ", I);
for(int j=0; J{
Printf (" % d ", a [j] - 48).
}
Printf (" % d \ n ", a] [I - 1-48).
For (int j=I - 1; J>=0; J -)
{
Printf (" % d ", a [j] - 48).
}
}
For your reference ~
Array length of 5 is not appropriate, because have to leave '\ n' a space, because you put '\ n' a [I], I changed to use 16, personal advice array length is defined as the space of 2 ^ n;
CodePudding user response:
The