Type Conversion to Display address of char variable

What exactly happens when *char is converted to *void and is there any other method that can be used to display the address of a character variable?

@poojagera
when u typecast from char * to void *. then ur pointer will start intrepreting the allocated memory as void type (i.e no type). using & operator u can print address of any variable,

1 Like

Yes but we cannot print the address of a character variable using the & operator. So, is there any other method except type conversion, to display the address of a char?

@poojagera
yeah we cannot print address of char variable by &someCharVariable because then it will behave as c string.
I think by type casting only we can print address dont know any other method.

1 Like

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.

1 Like