#include<iostream>
#include<string>
using namespace std;
#define ERROR 0
#define OK 1
#define OVERFLOW 2
typedef struct
{
char *ch;
int length;
}HString;
int StrAssign(HString &T,char *chars)
{ int i;
int c=strlen(chars);
if(T.ch) free(T.ch);
for(i=0; c; ++i,++c);
if(!i){T.ch=NULL; T.length=0;}
else
{
if(!(T.ch=(char *)malloc(i *sizeof(char))))
exit(OVERFLOW);
strcpy(T.ch,chars);
T.length=i;
}
return OK;
}
int StrLength(HString S)
{
return S.length;
}
int main()
{
HString S;
StrAssign(S,"Hello my name is zhang jia li");
return OK;
}