# Thread: Split up an Array

1. ## Split up an Array

Hello,
Im doing a project that i need to split up the first 6 bytes of an array individually. The first 3 bytes needs to be in Binary and the remaining 3 need to be in HEx. Any ideas , as i've only started learning C today!
Shane

2. What is the type of the array?
What is the contents?
What do you mean by split?

All data in computer - is binary, when talking about hex - talking about representation of the data. So how do you want to represent (print out) your data?

Code:
```int main(void)
{
return 0;
}```

3. honestly i don't know , but attached is the array
could u point me in the right dirtection

I need 128 to 152 to be sperated individually if that makes sence

4. Originally Posted by shanem
honestly i don't know , but attached is the array
could u point me in the right dirtection...
I need 128 to 152 to be sperated individually if that makes sence
No it still doesn't make any sense. Everything inside the machine is stored as binary so you can't separate them into binary and hex except at the presentation layer.

5. ....

6. Ok i'll try to be a bit more clear, The 128 value corresponds to 1000000

On my data sheet for this represents "Slave is in sync mode"
If the value comes in at 46 -101110 for example " Slave is in sync mode , freeze off ,slave is locked, watch dog on....) etc.

The second third fourth fifth and sixth bytes needs to be represented the same way.

So what i need to do is split up the first 6 bytes on the array, get there binary values and match that to my reference guide and display these messages in a text box!
Any takers,

7. 128 in binary is 10000000.
So, what, you have a list like this:
Code:
```#define SYNC_MODE 64
#define FREEZE 32
#define LOCKED 16
#define WATCHDOG 8```
and you want to know whether that particular bit is set? So why not do bitwise and?