char *stringmult(int n)
{
    char *x = "hello ";
    for (int i=0; i<n; ++i)
    {
     char *y = new char[strlen(x) * 2];
     strcpy(y,x);
     strcat(y,x);
     delete[] x;
     x=y;
    }
    return x;
}
I'm trying to figure out what the flaws of this segment is. For one, it deletes x and then tries to copy it's values over to y. Another is that y is twice the size of x and that y never gets deleted. Is there anything that I'm missing? And also, I need to figure out how to get algorithm performance. If you've got a quick link where you learned how, I'd appreciate it.