user48726: I have created a byte for 16x2 LCD. It is basically a custom character which I will have to change later.

byte char[8]{
 B10000,
 B01000,
 B00100,
 B00010,
 B00001,
 B11000,
 B11100
};

I want to edit the third number from fourth row. So, the fourth row will become B00110 from B00010. Is this possible? Are there any alternatives for this?

user31105: You can use the following array initialization:
In the setup I shows how to set a bit. For this, the bit operator or (|) is used. To reset a bit, you can use &. You can set/reset multiple bits this way.
Also you can use 1 << 2 which means 1 (most right bit) shifted left two places (thus B100).
Btw, it is common practice to initialize all values.
byte lcd[8] = 
{
  B10000,
  B01000,
  B00100,
  B00010,
  B00001,
  B11000,
  B11100,
  B00000  // Also initialize last element
};

void setup() 
{
   lcd[3] |= B100; // Set 4th row (element 3), 3th bit (from the right)
   lcd[3] |= 1 << 2; // Alternative
}

void loop() 
{
}

Explanation about the or arithmetics: OR means: if at least one bit is 1, the result is 1, otherwise 0.
Truth table:
A | B | A or B
--+---+-------
0 | 0 |   0
0 | 1 |   1
1 | 0 |   1
1 | 1 |   1

For your example it means:
Original value of lcd[3]: B00010
Or mask (in setup):       B00100
                          ------ OR
Result                    B00110


user41696: Well first of all you are trying to name the variable char? which is already a keyword for the variable type of char.   But you can access it by the index of the array. Also not sure if you intended to make the array 8 bytes in length, and then only use 7, but thats what you had done in your example
//define it all at once
// byte byteArray[8] = {B10000,B01000,B00100,B00010,B00001,B11000,B11100};
//or by index
byte byteArray[8];
byteArray[0]=B10000;
byteArray[1]=B01000;
byteArray[2]=B00100;
byteArray[3]=B00010;
byteArray[4]=B00001;
byteArray[5]=B11000;
byteArray[6]=B11100;


//if you need to change one in the code elsewhere
byteArray[3]=B00110;
//or
byteArray[3]=6;
}


48726: <p>I have created a <code>byte</code> for 16x2 LCD. It is basically a custom character which I will have to change later.
</p>

<pre class="lang-cpp prettyprint-override"><code>byte char[8]{
 B10000,
 B01000,
 B00100,
 B00010,
 B00001,
 B11000,
 B11100
};
</code></pre>

<p>I want to edit the third number from fourth row. So, the fourth row will become <code>B00110</code> from <code>B00010</code>. Is this possible? Are there any alternatives for this?</p>
 31105: <p>You can use the following array initialization:</p>

<p>In the setup I shows how to set a bit. For this, the bit operator or (|) is used. To reset a bit, you can use &amp;. You can set/reset multiple bits this way.</p>

<p>Also you can use 1 &lt;&lt; 2 which means 1 (most right bit) shifted left two places (thus B100).</p>

<p>Btw, it is common practice to initialize all values.</p>

<pre><code>byte lcd[8] = 
{
  B10000,
  B01000,
  B00100,
  B00010,
  B00001,
  B11000,
  B11100,
  B00000  // Also initialize last element
};

void setup() 
{
   lcd[3] |= B100; // Set 4th row (element 3), 3th bit (from the right)
   lcd[3] |= 1 &lt;&lt; 2; // Alternative
}

void loop() 
{
}
</code></pre>

<p>Explanation about the <code>or</code> arithmetics: OR means: if at least one bit is 1, the result is 1, otherwise 0.</p>

<p>Truth table:</p>

<pre><code>A | B | A or B
--+---+-------
0 | 0 |   0
0 | 1 |   1
1 | 0 |   1
1 | 1 |   1
</code></pre>

<p>For your example it means:</p>

<pre><code>Original value of lcd[3]: B00010
Or mask (in setup):       B00100
                          ------ OR
Result                    B00110
</code></pre>
 41696: <p>Well first of all you are trying to name the variable char? which is already a keyword for the variable type of char.   But you can access it by the index of the array. Also not sure if you intended to make the array 8 bytes in length, and then only use 7, but thats what you had done in your example</p>

<pre><code>//define it all at once
// byte byteArray[8] = {B10000,B01000,B00100,B00010,B00001,B11000,B11100};
//or by index
byte byteArray[8];
byteArray[0]=B10000;
byteArray[1]=B01000;
byteArray[2]=B00100;
byteArray[3]=B00010;
byteArray[4]=B00001;
byteArray[5]=B11000;
byteArray[6]=B11100;


//if you need to change one in the code elsewhere
byteArray[3]=B00110;
//or
byteArray[3]=6;
}
</code></pre>
