I have a char[16] array and i'm getting input from the user: Input for example- 15, 21 ,23, -1
I need to set the bit value to '1' for the place 15,21 and 23. -1 will finish the program.
Every char[16] array represent values from 0-127, that represents bits. I'm having problem entering '1' into 15,21 and 23 cells.
Here is my program
int temp;
char A[16];
/*Sets all the cells values to o*/
memset(A, 0, 16*sizeof(char));
While (int != -1)
{
scanf("Enter values from the user:%d", val");
div = (temp/8);
mod = (temp%8);
A[div] |= (mod<<=1);
}
The problem that it's not setting cell 15,21 and 23 values to '1'.