user61955: Suppose that one defined a data structure and wanted to send it through serial. 
 struct Gyro_data_structure {
    char command_name[5];
    float gyro_X;
    float gyro_Y;
    float gyro_Z;
};

Gyro_data_structure Gyro_data;

int size_gyro=sizeof(struct Gyro_data_structure);

void setup() {
  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop() {
  Gyro_data.command_name[0]='H';
  Gyro_data.gyro_X++;
  Serial.println(size_gyro);
  delay(500);
  Serial.write(Gyro_data,size_gyro);
}

However, it returned an error saying "no matching function for call to 'HardwareSerial:write(Gyro_data_structure&,int&)'". I googled and found Michaël Roy's answer here. However, it's not working: "can not convert ..."
How to send a structure through UART?

user7508: First of all, you have to decide whether you want to send the data as
raw bytes (“binary data”) or as an ASCII text representation. Binary
tends to be more efficient: you can send a float with full precision
in only four bytes, whereas you would typically need 8 to 9 significant
digits to recover the full precision from an ASCII representation.
Binary is, however, harder to handle: some types have different binary
representations on your Arduino and your PC, and you may need to define
a protocol of sorts in order to get the framing right. ASCII is easier,
and you can usually use end-of-lines as a simple framing device. I
generally recommend using ASCII unless you really need the extra
efficiency of a binary protocol.
Sending as binary
You can easily send arbitrary binary data using the method
write(const uint8_t *buffer, size_t size) from the Serial object:
Gyro_data_structure Gyro_data = {"Gyro", 0.0, 4.0, 5.0};

void loop() {
    Gyro_data.gyro_X++;
    Serial.write((uint8_t *) &Gyro_data, sizeof Gyro_data);
    delay(200);
}

Here is an hex dump of the output:
0000  47 79 72 6f 00 00 00 80  3f 00 00 80 40 00 00 a0  |Gyro....?...@...|
0010  40 47 79 72 6f 00 00 00  00 40 00 00 80 40 00 00  |@Gyro....@...@..|
[...]

which can be parsed as follows:
47 79 72 6f 00 = {'G', 'y', 'r', 'o', '\0'}
00 00 80 3f    = 0x3f800000 = 1.0f
00 00 80 40    = 0x40800000 = 4.0f
00 00 a0 40    = 0x40a00000 = 5.0f

Note that the floats are sent in little-endian order: lest significant
byte first. The 32-bit hex numbers above are the binary representations
of the floats.
Sending as text
Serial.print() is intended to print a text representation of the data
you give it. But since it does not know how to represent a
Gyro_data_structure, you have to Serial.print() each data member in
turn, and then add some formatting around all that:
void print_gyro(const Gyro_data_structure &gyro) {
    Serial.print(F("Gyro{command = \""));
    Serial.print(gyro.command_name);
    Serial.print(F("\", X = "));
    Serial.print(gyro.gyro_X);
    Serial.print(F(", Y = "));
    Serial.print(gyro.gyro_Y);
    Serial.print(F(", Z = "));
    Serial.print(gyro.gyro_Z);
    Serial.print(F("}"));
}

void loop() {
    Gyro_data.gyro_X++;
    print_gyro(Gyro_data);
    Serial.println();
    delay(200);
}

The output is
Gyro{command = "Gyro", X = 1.00, Y = 4.00, Z = 5.00}
Gyro{command = "Gyro", X = 2.00, Y = 4.00, Z = 5.00}
[...]

Making your data printable
This is a variation on the previous technique. You can Serial.print()
your object directly, if you tell the Arduino core how to print this
type of objects. This is done by letting your class inherit from
Printable and implementing the virtual method printTo(). But then
the class is not an “aggregate” anymore, and thus needs an explicit
constructor:
struct Gyro_data_structure : Printable
{
    char command_name[5];
    float gyro_X;
    float gyro_Y;
    float gyro_Z;
    Gyro_data_structure(const char *name, float x, float y, float z)
    : gyro_X(x), gyro_Y(y), gyro_Z(z) {
        strncpy(command_name, name, 4);
        command_name[4] = '\0';
    }
    size_t printTo(Print& p) const {
        size_t count = 0;
        count += p.print(F("Gyro{command = \""));
        count += p.print(command_name);
        count += p.print(F("\", X = "));
        count += p.print(gyro_X);
        count += p.print(F(", Y = "));
        count += p.print(gyro_Y);
        count += p.print(F(", Z = "));
        count += p.print(gyro_Z);
        count += p.print(F("}"));
        return count;
    }
};

Gyro_data_structure Gyro_data("Gyro", 0.0, 5.0, 5.0);

void loop() {
    Gyro_data.gyro_X++;
    Serial.println(Gyro_data);
    delay(200);
}

The output is identical as before. The definition of the class gets a
little bit clumsier, but then you can very easily print to any serial
port (be it an UART or a software implementation), to an LCD... or
whatever understands print().

user26478: I tried the code from the link you posted and it worked:
struct Gyro_data_structure
{
    char command_name[6];
    int gyro_X;
    int gyro_Y;
    int gyro_Z;
};

struct Gyro_data_structure Gyro_data = {"Hello", 48, 49 , 50};

int size_gyro = sizeof(struct Gyro_data_structure);

void setup() 
{
  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop()
{
  send(&Gyro_data);
  Serial.println();
  delay(1000);
}

void send (const Gyro_data_structure* table)
{
  Serial.write((const char*)table, size_gyro);  // 2 bytes.
}

bool receive(Gyro_data_structure* table)
{
  return (Serial.readBytes((char*)table, sizeof(Gyro_data_structure)) == sizeof(Gyro_data_structure));
}

I changed the float type to int for easy representation. When you run the code the serial window will show: Hello012
Because Arduino IDE serial window shows ASCII characters. 0's ASCII value is 48 and so on.

Update
It depends on what you want from the read function. Let's break down what Michaël Roy's implementation is doing. First, he reads sizeof(Gyro_data_structure) number of serial bytes and put it in the variable that table points to:
Serial.readBytes((char*)table, sizeof(Gyro_data_structure))

The 2nd argument of readBytes() takes how many bytes you want to read. Also readBytes() return how many bytes it read. Let's say we stored that number in return_bytes. In the next part he did:
return (return_bytes == sizeof(Gyro_data_structure))

He is checking if the number of bytes readBytes() read is the same as the size of  Gyro_data_structure. If it is not, then return false. 
This just tells you if you read more or less than what you are supposed to read. Regardless of true or false, the actual bytes that were read will be in the variable that you passed to the receive() function.
If you don't want the function to not return anything this is how it should be:
void receive(Gyro_data_structure* table)
{
  Serial.readBytes((char*)table, sizeof(Gyro_data_structure));
}


61955: <p>Suppose that one defined a data structure and wanted to send it through serial. </p>

<pre><code> struct Gyro_data_structure {
    char command_name[5];
    float gyro_X;
    float gyro_Y;
    float gyro_Z;
};

Gyro_data_structure Gyro_data;

int size_gyro=sizeof(struct Gyro_data_structure);

void setup() {
  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop() {
  Gyro_data.command_name[0]='H';
  Gyro_data.gyro_X++;
  Serial.println(size_gyro);
  delay(500);
  Serial.write(Gyro_data,size_gyro);
}
</code></pre>

<p>However, it returned an error saying "no matching function for call to 'HardwareSerial:write(Gyro_data_structure&amp;,int&amp;)'". I googled and found Michaël Roy's answer <a href="https://stackoverflow.com/questions/45600202/arduino-how-to-feed-a-struct-from-a-serial-read">here</a>. However, it's not working: "can not convert ..."</p>

<p>How to send a structure through UART?</p>
 7508: <p>First of all, you have to decide whether you want to send the data as
raw bytes (“binary data”) or as an ASCII text representation. Binary
tends to be more efficient: you can send a <code>float</code> with <em>full precision</em>
in only four bytes, whereas you would typically need 8 to 9 significant
digits to recover the full precision from an ASCII representation.
Binary is, however, harder to handle: some types have different binary
representations on your Arduino and your PC, and you may need to define
a protocol of sorts in order to get the framing right. ASCII is easier,
and you can usually use end-of-lines as a simple framing device. I
generally recommend using ASCII unless you <em>really</em> need the extra
efficiency of a binary protocol.</p>

<h2>Sending as binary</h2>

<p>You can easily send arbitrary binary data using the method
<code>write(const uint8_t *buffer, size_t size)</code> from the <code>Serial</code> object:</p>

<pre class="lang-cpp prettyprint-override"><code>Gyro_data_structure Gyro_data = {"Gyro", 0.0, 4.0, 5.0};

void loop() {
    Gyro_data.gyro_X++;
    Serial.write((uint8_t *) &amp;Gyro_data, sizeof Gyro_data);
    delay(200);
}
</code></pre>

<p>Here is an hex dump of the output:</p>

<pre><code>0000  47 79 72 6f 00 00 00 80  3f 00 00 80 40 00 00 a0  |Gyro....?...@...|
0010  40 47 79 72 6f 00 00 00  00 40 00 00 80 40 00 00  |@Gyro....@...@..|
[...]
</code></pre>

<p>which can be parsed as follows:</p>

<pre><code>47 79 72 6f 00 = {'G', 'y', 'r', 'o', '\0'}
00 00 80 3f    = 0x3f800000 = 1.0f
00 00 80 40    = 0x40800000 = 4.0f
00 00 a0 40    = 0x40a00000 = 5.0f
</code></pre>

<p>Note that the floats are sent in little-endian order: lest significant
byte first. The 32-bit hex numbers above are the binary representations
of the floats.</p>

<h2>Sending as text</h2>

<p><code>Serial.print()</code> is intended to print a text representation of the data
you give it. But since it does not know how to represent a
<code>Gyro_data_structure</code>, you have to <code>Serial.print()</code> each data member in
turn, and then add some formatting around all that:</p>

<pre class="lang-cpp prettyprint-override"><code>void print_gyro(const Gyro_data_structure &amp;gyro) {
    Serial.print(F("Gyro{command = \""));
    Serial.print(gyro.command_name);
    Serial.print(F("\", X = "));
    Serial.print(gyro.gyro_X);
    Serial.print(F(", Y = "));
    Serial.print(gyro.gyro_Y);
    Serial.print(F(", Z = "));
    Serial.print(gyro.gyro_Z);
    Serial.print(F("}"));
}

void loop() {
    Gyro_data.gyro_X++;
    print_gyro(Gyro_data);
    Serial.println();
    delay(200);
}
</code></pre>

<p>The output is</p>

<pre><code>Gyro{command = "Gyro", X = 1.00, Y = 4.00, Z = 5.00}
Gyro{command = "Gyro", X = 2.00, Y = 4.00, Z = 5.00}
[...]
</code></pre>

<h2>Making your data printable</h2>

<p>This is a variation on the previous technique. You can <code>Serial.print()</code>
your object directly, if you tell the Arduino core how to print this
type of objects. This is done by letting your class inherit from
<code>Printable</code> and implementing the virtual method <code>printTo()</code>. But then
the class is not an “aggregate” anymore, and thus needs an explicit
constructor:</p>

<pre class="lang-cpp prettyprint-override"><code>struct Gyro_data_structure : Printable
{
    char command_name[5];
    float gyro_X;
    float gyro_Y;
    float gyro_Z;
    Gyro_data_structure(const char *name, float x, float y, float z)
    : gyro_X(x), gyro_Y(y), gyro_Z(z) {
        strncpy(command_name, name, 4);
        command_name[4] = '\0';
    }
    size_t printTo(Print&amp; p) const {
        size_t count = 0;
        count += p.print(F("Gyro{command = \""));
        count += p.print(command_name);
        count += p.print(F("\", X = "));
        count += p.print(gyro_X);
        count += p.print(F(", Y = "));
        count += p.print(gyro_Y);
        count += p.print(F(", Z = "));
        count += p.print(gyro_Z);
        count += p.print(F("}"));
        return count;
    }
};

Gyro_data_structure Gyro_data("Gyro", 0.0, 5.0, 5.0);

void loop() {
    Gyro_data.gyro_X++;
    Serial.println(Gyro_data);
    delay(200);
}
</code></pre>

<p>The output is identical as before. The definition of the class gets a
little bit clumsier, but then you can very easily print to any serial
port (be it an UART or a software implementation), to an LCD... or
whatever understands <code>print()</code>.</p>
 26478: <p>I tried the code from the link you posted and it worked:</p>

<pre><code>struct Gyro_data_structure
{
    char command_name[6];
    int gyro_X;
    int gyro_Y;
    int gyro_Z;
};

struct Gyro_data_structure Gyro_data = {"Hello", 48, 49 , 50};

int size_gyro = sizeof(struct Gyro_data_structure);

void setup() 
{
  Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop()
{
  send(&amp;Gyro_data);
  Serial.println();
  delay(1000);
}

void send (const Gyro_data_structure* table)
{
  Serial.write((const char*)table, size_gyro);  // 2 bytes.
}

bool receive(Gyro_data_structure* table)
{
  return (Serial.readBytes((char*)table, sizeof(Gyro_data_structure)) == sizeof(Gyro_data_structure));
}
</code></pre>

<p>I changed the <strong>float</strong> type to <strong>int</strong> for easy representation. When you run the code the serial window will show: <strong>Hello012</strong></p>

<p>Because Arduino IDE serial window shows ASCII characters. 0's ASCII value is 48 and so on.</p>

<hr>

<h1>Update</h1>

<p>It depends on what you want from the read function. Let's break down what Michaël Roy's implementation is doing. First, he reads <strong>sizeof(Gyro_data_structure)</strong> number of serial bytes and put it in the variable that table points to:</p>

<pre><code>Serial.readBytes((char*)table, sizeof(Gyro_data_structure))
</code></pre>

<p>The 2nd argument of readBytes() takes how many bytes you want to read. Also readBytes() return how many bytes it read. Let's say we stored that number in <strong>return_bytes</strong>. In the next part he did:</p>

<pre><code>return (return_bytes == sizeof(Gyro_data_structure))
</code></pre>

<p>He is checking if the number of bytes readBytes() read is the same as the size of  <strong>Gyro_data_structure</strong>. If it is not, then return <strong>false</strong>. </p>

<p>This just tells you if you read more or less than what you are supposed to read. Regardless of true or false, the actual bytes that were read will be in the variable that you passed to the receive() function.</p>

<p>If you don't want the function to not return anything this is how it should be:</p>

<pre><code>void receive(Gyro_data_structure* table)
{
  Serial.readBytes((char*)table, sizeof(Gyro_data_structure));
}
</code></pre>
