Home Segments Index Top Previous Next

258: Mainline

The following is a C definition of the trade structure; evidently, the individual chunks of memory that describe trades hold values for a floating-point number (namely, the price per share), and an integer (namely, the number of shares traded):

struct trade { 
    double price; 
    int number; 
}; 

Here is what each part does:

struct          <-- Tells C that a structure is to be defined 
  trade         <-- Tells C the name of the structure 
    {           <-- Marks the beginning of the body 
  double price; <-- Introduces floating point variable 
  int number;   <-- Introduces integer variable 
}               <-- Marks the end of the body 
   ;            <-- Marks the end of the structure definition