Quote Originally Posted by tabstop View Post
As opposed to "char input1; char input2" which creates ... two slots of characters?
ok im not going to pretend i know close to as much as you do but here's what i thought was going on:

with input1; input2; method i thought i'd first store the user input and then somehow convert that char variable to an 8 bit binary which would then be stored into an array of 8 slots. so here's where my question to you guys came in because i wasn't sure how i would convert the character to its binary equivalent.

with two_characters[2], as far as I know im creating an array with two slots, which say if the user inputs 'a' and '=' then two_characters[0] will hold 'a' and two_characters[1] will hold '='.

but that is different than an array which holds 8 bits as far as I know. unless this array your suggesting has nothing to do with the binary array.

Well, I'm assuming you want to convert two character nibbles to a binary byte. I think it's probably safe for you to assume that a byte can be represented by an unsigned char which will hold 8 bits.

This means you just need to convert a string "A5", to a binary equivalent of 165 and store it in an unsigned char variable.

Start with the most significant digit (A in my example), and convert that to a binary value (10). Multiple that value by 16, then add the binary value of the least significant digit (5).

This gives you 10 * 16 + 5 = 165.
thanks for the advice but it's a little off. i'm not trying to convert a string that consists of two characters into one binary big binary number. instead i give the user the ability to input to characters. and both characters will have their own array of their binary equivalent. so essentially i'd have two bytes. should've made it clearer, sorry.