mahesh_anasuri wrote:
> int main()
> {
> char *str = new char[12];
> delete [] str;
>
> char *test = new char[12];
> strcpy(str, "surprise !");
> cout << test << str;
> delete [] test;
>
> }
>
> What is the reason behind same o/p for both pointers, though test is
> not copied with any data?
Besides writing to memory you don't technically/necessarily own and
experimenting with bad programming practices, you have new/delete
statements at the application layer. Go read Safe C++ Design Principles
(free e-book for c-prog members located in the Books section of this
group's website).
--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
*NEW* VerifyMyPC 2.5
Change tracking and management tool.
Reduce tech. support times from 2 hours to 5 minutes.
http://www.CubicleSoft.com/VerifyMyPC/