Does casting actually DO anything?
问题 Consider the following snippet: char x[100]; double *p = &x; As expected, this yields this warning: f.c:3:15: warning: initialization of ‘double *’ from incompatible pointer type ‘char (*)[100]’ [-Wincompatible-pointer-types] 3 | double *p = &x; | ^ This is very easy to solve by just changing to double *p = (double*)&x; My question here is, does the casting actually DO anything? Would the code be invalid without the cast? Or is it just a way to make the compiler quiet? When is casting