anyone know how to assign bit in C
anyone know how to assign bit in C
Yes.
What's the question? What do you want to do.
Usual use binary AND or OR operators.
C does have bit fields, but they are not used much.
Code:{ unsignedint widthValidated :1; unsignedint heightValidated :1; } status;
I researched this is how bits are assigned, but it only works for 1 and not 0
how do I assign 0?
So what do you see when you do
status.widthValidated = 0;
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
You asked?
You have a compiler sitting in front of you, and it was a 1 character change to change 0 to 1 and find out.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.