how to solve pointer problem?
how to solve pointer problem?
In the following code :- #include<iostream> using namespace std; main() { char*pch = new char[10]; pch = "rahul"; // this statement causees memory leak error when deleting pch delete pch; return 0; } what should I do so that we can avoid aboe error BUT I want to use only pointer and don't want to use in built C functions or C++ in built classes such as string. |
Quote:
|
Quote:
|
All times are GMT -5. The time now is 09:17 PM. |