storing characters in char data type C language

Posted by iSight on Stack Overflow See other posts from Stack Overflow or by iSight
Published on 2010-06-02T13:50:19Z Indexed on 2010/06/02 13:54 UTC
Read the original article Hit count: 137

Filed under:

Hi,

I can store string of few length in char data type.

But when it exceeds its capacity what can be the alternative way to store string.

I am using char data type.

void setString(char* inPoints)
{
if (strcmp(mPoints, inPoints)!= ZERO) {

    if (mPoints) {

        free(mPoints);
    }

    mPoints = (char*)malloc((strlen(inPoints) + 1)  * sizeof(char));

    strcpy(mPoints, inPoints);
}
}

© Stack Overflow or respective owner

Related posts about c