Home Segments Index Top Previous Next

361: Mainline

To determine how many bytes of memory you need to store an object of a particular type, you deploy the sizeof operator using the object's type as the argument. Thus, sizeof (int) returns 4 in most implementations, because int objects occupy 4 bytes. Similarly, sizeof (struct trade) returns the number of bytes occupied by a trade object, which is likely to be 12, assuming that a trade object contains exactly one floating-point number representing the price per share traded and one integer representing the number of shares traded.