#include
#include
Int main () {
Char * a=(char *) malloc (5 * sizeof (char));
Char * b=a;
for(int i=0; i<5; I++) {
* (b++)='1';
}
Printf (" % s \ n ", a);
}
CodePudding user response:
Printf (" % s \ n ", a);
CodePudding user response:
C string to end with a '\ 0',The following code for reference
#include
#include
# define N 5
Int main ()
{
Char * a=(char *) malloc ((N + 1) * sizeof (char));
int i;
For (I=0; i{
* (a + I)='1'.
}
* (a + I)='\ 0';
Printf (" % s \ n ", a);
return 0 ;
}
CodePudding user response:
And the lack of the terminatorCodePudding user response: