user58738: I am working on a small piece of code as shown:

When I enter character 'a' in the Serial Monitor and use a delay in between successive reads then the monitor gives out acceptable results(i.e 97 for character 'a' and 10 for new line) as shown:

Whereas if I do not include the delay, it seems like the microcontroller is not able to read the next value(i.e 10 for new line) immediately and just gives out a -1. And it is only after the loop is run again that we get to see the value 10 for new line(again with -1).

Is my observation correct? If yes, what causes this to occur? 
EDIT: I am sorry for the improper format of displaying the code. I am adding the code as below:
#include <Wire.h>

void setup() {

  // Initialize I2C communications as Master
  Wire.begin();
  // Setup serial monitor
  Serial.begin(9600);
  Serial.println("I2C Master Demonstration");
}

void loop() {

  if(Serial.available()>0)
  { 
    char c = Serial.read();
    Serial.print((int)c);
    delay(10);            
    char d=Serial.read();  
    Serial.print((int)d);
    Serial.println("Writing data to slave...");  
}
}


user37622: Yes, UART is much slower then the CPU and you run it on extremely slow baud rate. The CPU runs many loops before Serial.available() is again more then 0.
From reference of read() function:

Returns the first byte of incoming serial data available (or -1 if no data is available). 


58738: <p>I am working on a small piece of code as shown:
<a href="https://i.stack.imgur.com/ZxfJs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZxfJs.jpg" alt="enter image description here"></a></p>

<p>When I enter character 'a' in the Serial Monitor and use a delay in between successive reads then the monitor gives out acceptable results(i.e 97 for character 'a' and 10 for new line) as shown:
<a href="https://i.stack.imgur.com/FQChX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FQChX.jpg" alt="enter image description here"></a></p>

<p>Whereas if I do not include the delay, it seems like the microcontroller is not able to read the next value(i.e 10 for new line) immediately and just gives out a -1. And it is only after the loop is run again that we get to see the value 10 for new line(again with -1).</p>

<p><a href="https://i.stack.imgur.com/trOpK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/trOpK.jpg" alt="enter image description here"></a></p>

<p>Is my observation correct? If yes, what causes this to occur? </p>

<p>EDIT: I am sorry for the improper format of displaying the code. I am adding the code as below:</p>

<pre><code>#include &lt;Wire.h&gt;

void setup() {

  // Initialize I2C communications as Master
  Wire.begin();
  // Setup serial monitor
  Serial.begin(9600);
  Serial.println("I2C Master Demonstration");
}

void loop() {

  if(Serial.available()&gt;0)
  { 
    char c = Serial.read();
    Serial.print((int)c);
    delay(10);            
    char d=Serial.read();  
    Serial.print((int)d);
    Serial.println("Writing data to slave...");  
}
}
</code></pre>
 37622: <p>Yes, UART is much slower then the CPU and you run it on extremely slow baud rate. The CPU runs many loops before Serial.available() is again more then 0.</p>

<p>From <a href="https://www.arduino.cc/reference/en/language/functions/communication/serial/read/" rel="nofollow noreferrer">reference of read() function</a>:</p>

<blockquote>
  <p>Returns the first byte of incoming serial data available (or -1 if no data is available). </p>
</blockquote>
