[Help]Concatenate byte arrays

Posts 1–7 of 7 · Page 1 of 1
[Help]Concatenate byte arrays
Code:
byte one[] = { 1, 1 };
byte two[] = { 2, 4 };
byte three[sizeof(one) + sizeof(two)] = ?
I'm stumped on how to do this (efficiently). /:
I'm not sure if there is any way to do that at compile time without using #defines. I'm talking about something like this:
Code:
#define _ONE 1, 1
#define _TWO 2, 4
byte one[] = {_ONE};
byte two[] = {_TWO};
byte three[] = {_ONE, _TWO};
I'm sure there is a less hacky way to do it though.
[Help] Tags added, It's easier for us to know what it is you are looking for
I want to do this at run time O:

I know I can just iterate through each byte and assign it, but is there a function that does it for me? (a C++ function that may be more efficient or faster or something_
Quote Originally Posted by freedompeace View Post
//b-bump? S:
1. Don't double post.
2. The fastest you could get this at run-time would probably using memcpy to copy the bytes.
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us