Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have storage a "bits" in integer array for example
int a = {1,0,1,1}
How I will be able to convert the integer array "bits" into unsigned char "bits"?
and reciprocal?
{1,0,1,1}
unsigned char
int int_array[] = {1, 0, 1, 1}; unsigned char uc_array[sizeof int_array / sizeof *int_array]; for (size_t i = 0; i != sizeof int_array / sizeof *int_array; ++i) uc_array[i] = int_array[i];
(Your sample code is flawed: it has too many initializers for a scalar variable)
Add a comment
int a[]
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
{1,0,1,1}tounsigned chare.g, unsigned char x = 1011; or its binary representation?