Home > Back-end >  Malloc dynamic open space when asked what their size are always changing
Malloc dynamic open space when asked what their size are always changing

Time:09-21

Int StrAssign (HString & amp; T, char * chars) {
Int I, n; int m;
Char * c=chars;
If h (tc), free (tc h);
For (c, I=0; * c; I++, c + +);
if (! I) {tc h=NULL; T.l ength=0; }
The else {
if(! (tc h=(char *) malloc (I * sizeof (char))))
return ERROR;
For (n=0; N & lt; i; N++)
Tc h [n]=chars [n].
T.l ength=I;
}//generates a string T its value is equal to the chars;
return OK;
}

CodePudding user response:

Tc h=(char *) malloc (I * sizeof (char))
The I variable size

CodePudding user response:

Is upstairs and said I was a variable is the change,
  • Related