can someone please explain whats wrong with the below code segment? My intention is to assign characters in pointer "p" to pointer "a" one by one until the end. but this throws run time exception. I want to do assign character by chater without assigneing the entire pointer as a whole. Is there any other inbulid function to do character concatenation?
char *p = "asd";
char * a;
for (int i = 0; *p != '\0' ; ++i)
{
// std::cout << *p++;
strcat(a,p);
p++;
}