#include <stdio.h>
#include <stdlib.h>

typedef char byte;

byte* floatToByteArray(float f) {
	byte* ret = malloc(4 * sizeof(byte));
	unsigned int asInt = *((int*)&f);
	
	int i;
	for (i = 0; i < 4; i++) {
		ret[i] = (asInt >> 8 * i) & 0xFF;
	}
	
	return ret;
}
	

int main(void) {
	float f = 1.0;
	
	byte* asBytes = floatToByteArray(f);
	
	int i;
	for(i = 0; i < 4; i++) {
		printf("Byte #%i: %i\n", i, asBytes[i]);
	}
	
	return 0;
}
