You're not making too much sense. I think you make a confusion between bits and bytes. I guess what you want is to extract data from an array of bytes. Notice there is no byte type in C++, that is probably a typedef (for unsigned char). I also guess what you are looking for is something like this:
int extract_int(unsigned char array, size_t offset)
int n = 0;
memcpy(&n, array + offset, sizeof(n));
However, this does not address some issues:
- the endianess: little endian vs. big endian, and how your data is stored in the array; my sample assume it's little endian
- validation: you need to do some extra validation, like that offset + sizeof the extracted data type is not beyond the boundaries of the array.