Hello,
first say I'm not good with bit operations (I'm still learning and practing with them) so if my question is so trivial forgive me.
I'm trying to modify a bit of a character and keep the others intact (the last one), when i try to put a one it seems be working but when i try to put a zero it works sometimes but others don't. The two simple functions I'm using are the following:
For example if I use 't' (int value 116) as argument, put_one returns 'u' (int value 117) what seems to be correct. The problem is with put_zero, it should return the same value ('t' int value 116) but it returns 'D' int value 68.Code:void put_one(char *c){ *c|= 00000001; } void put_zero(char *c){ *c&= 11111110; }
So, what I'm doing wrong? Is there any better way to do this task?
Thanks in advance, and sry if this question is so basic.