[Solved] C++ Convert part of the Array into int
Hard to be sure because your question isn’t very clear. But perhaps this is what you want uint16_t z = *reinterpret_cast<uint16_t*>(array); Another possiblity is uint16_t z = static_cast<uint8_t>(buf[0])*256 + static_cast<uint8_t>(buf[1]); and another is uint16_t z = static_cast<uint8_t>(buf[1])*256 + static_cast<uint8_t>(buf[0]); Try them all, they differ only in what endianness they use. You should look that up. … Read more