0

Why don't we use astrix in free up of pointer ?i.e. (delete*p)???

someone can tackle this out plss

4th Jan 2018, 9:31 PM
ANURAG SHARMA
ANURAG SHARMA - avatar
2 Answers
+ 7
Because at runtime the code context has changed the meaning of the asterisk from "definition" to "dereferencing" -- it already knows the variable type is a pointer.
4th Jan 2018, 10:12 PM
Kirk Schafer
Kirk Schafer - avatar
+ 1
You don't want to delete the value *p, but the whole pointer p. Really though, just use smart pointers.
4th Jan 2018, 9:59 PM
1of3
1of3 - avatar