char * p_one = "this is my first char pointer";
char * p_two= "this is second";
strcpy(p_one ,p_two);
consider the above code. This is giving access violation error. So please help to understand
- where is the current
"this is my first char pointer"string stored in memory? heap or stack - why I need to allocate memory for p_one before call
strcpy, even it's already storing the first string. why"this is second"string cannot copy to same location? - If I allocate memory for p_one before call
strcpythen what happen to"this is my first char pointer"string that was pointed by p_one ? is it keep in memory? - How
strcpyknows specific pointer have allocated memory or not?