hey..I need to convert a 8 value bool array to char.How can I do this?
AutoC 0 Junior Poster in Training
Recommended Answers
Jump to PostI had
char boolsToChar(bool* bools){ char c = 0; for( int i = 0; i < 8; i++ ) if( bools[i] ) c += pow(2,i); return c; }
but clearly this is not as nice a solution as above, For multiple reasons.
One being that I …
Jump to PostHow about this, rather unusual method ;)
#include <iostream> struct octet { union { char val; struct { unsigned h : 1; unsigned g : 1; unsigned f : 1; unsigned e : 1; unsigned d : 1; unsigned c : 1; unsigned b : 1; unsigned …
All 5 Replies
Alex Edwards 321 Posting Shark
Paul.Esson 53 Junior Poster
Alex Edwards 321 Posting Shark
William Hemsworth 1,339 Posting Virtuoso
AutoC 0 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.