int main(int argc, char* argv[])
{
char *pTest = new char[10];
char* pStr = new(pTest) char[10];
strcpy(pTest,"Rammohan");
strcpy(pTest,"Sundar");
printf("%s",pStr);
if(pStr)
{
delete pStr;
}
getch();
return 0;
}
output is : Sundar
Only one pointer is used...
No comments:
Post a Comment