What is the most efficient way to read a bit at a particular position in a byte?
tomz6 0 Newbie Poster
Recommended Answers
Jump to PostHere is a sample of code to test for a set bit. Adapt as necessary.
#include <stdio.h> int main(void) { unsigned char target_byte = 0x81; unsigned int i = 0; /* Always initialize variables - much safer! */ for (i = 0x01; i <= 0x80; i = …
All 4 Replies
Moschops 683 Practically a Master Poster Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
RonalBertogi 46 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.