C convert unsigned char array to float array
问题 Is there a way to convert unsigned char array to float array without dereferencing each element of uchar array? unsigned char* arr1 = malloc(sizeof(unsigned char) * 3); float* arr2 = malloc(sizeof(float) * 3); *arr1 = 3; *(arr1 + 1) = 55; *(arr1 + 2) = 213; *arr2 = (float)(*arr1); // 3.0 *(arr2 + 1) = (float)(*(arr1 + 1)); // 55.0 *(arr2 + 2) = (float)(*(arr1 + 2)); // 213.0 来源: https://stackoverflow.com/questions/62136164/c-convert-unsigned-char-array-to-float-array