I'm learning about type casting and finding it pretty tough to understand it. So from what I've learned. You cannot static cast pointers of one type to another. I don't know exactly why. Because you can static cast an int to a char which has there own address in memory so its super confusing me as to why you cannot do the same with pointers.
So with reinterpret cast. You can convert a pointer type to another pointer type. I think?
So a few questions i have are. You can convert non pointer variables with a static cast.
And You can cast pointers types to different pointer types using reinterpret?
Below are some examples of stuff I'm struggling on.
<int *>something // what is the * inside of the <int> meaning?
// i know what the previous *<int> means to deference.
// So if i have this does this mean I'm casting something into a char pointer
// and storing the cast inside of ptr?
char* ptr = static_cast<char *>something
//With reinterpret cast i can cast from another type like this
int x = 9;
int* ptr = {&x};
char* nowchar = reinterpret_cast<char *>&x
// the above is fine?
//But i cannot do the same with static
int x = 8;
int* ptr = {&x};
char* nowchar = static_cast<char*>&x;
Can you explain why i cannot use static on a pointer, and why reinterpret_cast works