the pointer section does not includes the type casting of pointers. Will it come in the next videos or what? Because it is an important topic of pointers.
Type casting of pointers
in c++ it is illegal to assign a pointer of a certain type to a pointer of another type.
however you can do so by typecasting the pointer first.
For example,
int a = 10;
int *pi = &a;
char ch = ‘b’;
int *pc = &ch;
//you cannot do pc = pi
//do this instead
pc = (char*) pi;
//typecast the existing pointer to the datatype of the pointer you wish to do the assignment to
i hope i have resolved your query, please mark your doubt as resolved if you are satisfied
Hey Ankita since you are not responding to this thread I am marking your doubt as resolved for now. Please re-open it if required.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.