Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Is it really important to put that semicolon there and if, why?</p> </blockquote> <p>Yes. This can be useful sometime. </p> <p>You can define a struct, and can declare an object as:</p> <pre><code>struct A { //members } obj; </code></pre> <p><code>obj</code> is an object of type <code>A</code>, and you declare this just as shown above. It is in same way you put semicolon after declaring variables, such as:</p> <pre><code>int i; //declares i of type int std::string s; //declares s of type std::string struct {int x,y,z;} point; //declares point of an unnamed struct type </code></pre> <p>Here first two declarations look very familiar, but the last one looks slightly unfamiliar, as it defines an unnamed struct, and simultaneously declares an object called <code>point</code> of the unnamed struct.</p> <p>The bottomline is that you put a semicolon after declaring objects uniformly, no matter how you declare the objects, no matter what their types are.</p> <p>Not only that you can even <code>typedef</code> in a uniform way:</p> <pre><code> typedef int my_int; typedef std::string my_string; typedef struct {int x,y,z;} my_point; </code></pre> <p>Now all of these <code>my_int</code>, <code>my_string</code>, and <code>my_point</code> are types.</p> <p>But when you do neither of them (i.e neither declaring objects, nor defining typedefs), then you simply leave the place as such, blank, with no declaration/definition whatsoever. But the point to be noted is that it gives you an interesting and useful feature all along.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload