How can I store a char * in a struct which as an unsigned int : I'm trying to store a char into my `_float`. I do this in my `getBits` function. However, I am a little confused. I am trying to store the chars into the struct but when I print it out, it only prints the whatever the first digit is.

    Example:
    /program 0 10000100 01000000010000100000000
    Test 1
    // The answer should be 10000100?

So my question is how do I store it correctly?


    struct _float {
        unsigned int sign:1, exp:8, frac:23;
    };
    typedef struct _float Float32;
    
    union _bits32 {
        float    fval;  // Bits as a float
        Word     xval;  // Bits as a word
        Float32 bits;  // manipulate individual bits
    };
    typedef union _bits32 Union32;
    
    int main(int argc, char **argv) {
        union _bits32 u;
        char out[50];
    
        u.bits.sign = u.bits.exp = u.bits.frac = 0;
    
        u = getBits(argv[1], argv[2], argv[3]);
    
        return 0;
    }

    // convert three bit-strings (already checked)
    // into the components of a struct _float
    Union32 getBits(char *sign, char *exp, char *frac) {
        Union32 new;
        
        // convert char *sign into a single bit in new.bits
        new.bits.sign = *sign;
        
        // convert char *exp into an 8-bit value in new.bits
        new.bits.exp = *exp;
        printf("Test %c\n", new.bits.exp); // <<<<<<<<< My question is here
            
        // convert char *frac into a 23-bit value in new.bits
        new.bits.frac = *frac;
    
        return new;
    }

