Is casting from TYPE* to unsigned char* allowed?
问题 C99 -- specifically section 6.2.6.1, paragraph 4 -- states that copying an object representation into an array of unsigned char is allowed: struct { int foo; double bar; } baz; unsigned char bytes[sizeof baz]; // Do things with the baz structure. memcpy(bytes, &baz, sizeof bytes); // Do things with the bytes array. My question: can we not avoid the extra memory allocation and copy operation by simply casting? For example: struct { int foo; double bar; } baz; unsigned char *bytes = (void *)