Serial.setTimeout()

void setup()
{
  Serial.begin(9600);
}
void loop()
{char a[10];
if(Serial.setTimeout(1000)<1000)
{
  if(Serial.available())
  {
    int b=Serial.readBytes(a,10  );
    Serial.println(b);
  }
}}

is this way of using Serial.settimeout().if not please correct me.thanks

try this

char a[10];

const int timeout=1000;

void setup()
{
  Serial.begin(9600);
  Serial.setTimeout(timeout);  // only need to be set once
}

void loop()
{
  Serial.println("type a number of chars followe dby return");

  int b = Serial.readBytes(a, 10);
  Serial.print("bytes read: \t");
  Serial.println(b);
  delay(1000); 
}
 Serial.println(b);

or

 Serial.println(a);

? Where was b declared or is it important?

Doc

@docedision
why do you want go for Serial.print (a);
because Serial.readbytes return number of character in bytes that is stored in b.
mistakenly i have used serial.Print(a); in some of my code.but i got junk values.