I would like to ask reagrding on this line of code :
class1 *pointer = (class1 *)msg;
the class declaring a pointer to be equal with "(class1 *)msg"
My question is the parenthesis is for? as the msg is already declared as pointer based on the "int func(void *msg)" so is it the parenthesis is to avoid another declare of pointer in msg? as i know there is no such pointer declare or class pointer declare where by the astrik(*) is behind the variable eg: p*
hope you guys can explain to be the line of code..
Type of pointer is class1*. Type of msg is void*. You cannot implicitly convert one pointer type to another (except child to parent), thus an explicit cast is needed. (some_type)some_variable means that some_variable will be converted to some_type. It's not just for pointers. (float)my_int or etc. is common.