dynamic memory allocation for charecter

i have to just do dynamic memory allocation for char without asking for no of charecters users want...

#include <iostream>

int main ()
{
char* a;
gets(a); \\but it gives run time error
i=strlen(a);
a=new char[i];
puts(a);
getch();
}
Topic archived. No new replies allowed.