Home Segments Index Top Previous Next

448: Mainline

You can image the definition of two structure types, one for stock trades and one for bond trades:

/* Preliminary versions /* 
struct stock_trade {double price; int number; int pe_ratio;}; 
struct bond_trade {double price; int number; double yield;}; 

As defined, bond_trade objects require 4 bytes more than stock_trade objects, in most implementations, because the floating-point number, yield, consumes 8 bytes, whereas the integer, pe_ratio, consumes just 4 bytes.