c - How to form a character byte by assigning values to each of the bits? -


I have a C function that accepts one letter. I need to remove this character too. I am clear with the extraction part. Can someone give me the idea of ​​incorporating the values ​​of bits?

Say that you want to check nth a bit of four:

  Int CheckBit (Four C, Int N) {Return C & amp; (1 & lt; & lt; n); }   

To set the nth bit:

  zero setbit (char * c, int n) {* c | = 1 & lt; & Lt; N; }    

Comments