C语言 拆分float 数据为4个字节数据

#include <stdio.h>

union FloatToByte {

    float f;

    unsigned char b[4];

};

int main() {

    union FloatToByte fb;

    fb.f = 3.14;

    printf("float: %f\n", fb.f);

    printf("byte0: %u\n", fb.b[0]);

    printf("byte1: %u\n", fb.b[1]);

    printf("byte2: %u\n", fb.b[2]);

    printf("byte3: %u\n", fb.b[3]);

    return 0;

}