Hi, I have tried to compile this program but there is warning:
//argumented constructor
//initializes string array with passed argument
MyString::MyStr ing(const char* s)
{
int len = strlen(s);
if(len <= StringCapacity) //size <= 80
{
strcpy(StringAr ray, s);
StringSize = len;
}
else //size > 80
{
int i;
for(i=0;i<=Stri ngCapacity;i++)
StringArray[i] = s[i];
StringArray[i] = '\0';
StringSize = StringCapacity;
}
}
warning: incompatible types in assignment of int to char.
Please help fix this, thank you very much
//argumented constructor
//initializes string array with passed argument
MyString::MyStr ing(const char* s)
{
int len = strlen(s);
if(len <= StringCapacity) //size <= 80
{
strcpy(StringAr ray, s);
StringSize = len;
}
else //size > 80
{
int i;
for(i=0;i<=Stri ngCapacity;i++)
StringArray[i] = s[i];
StringArray[i] = '\0';
StringSize = StringCapacity;
}
}
warning: incompatible types in assignment of int to char.
Please help fix this, thank you very much
Comment