i was reading a book and came across this line
"C++ matches a pointer of any other type with type void * and prints a numeric representation
of the address. If you want the address of the string, you have to type cast it to
please any one could explain this with the help of an example.
void* is just a generic term for a pointer of any type. For example, malloc() returns void*. If you really want a pointer of type char* then, in c++, you have to typecast the return value of malloc().
char* p = (char*)malloc(15);
In the above, malloc will allocate memory for 15 bytes of memory and return a pointer to that memory block. Since pointers are all the same size in c++ you can easily just typecast it to whatever kind of pointer you want.