Slices & Articles Get by the slice or add to your own ebook
|Johan Vromans||O'Reilly Media||ePub|
printf and sprintf format a list of values according to a format string that may use the following conversions:
A percent sign.
An unsigned integer (binary).
The character corresponding to the ordinal value.
A signed integer.
A floating-point number (scientific notation).
A floating-point number (fixed decimal notation).
A floating-point number
A synonym for
The number of characters formatted so far is stored into the corresponding variable in the parameter list.
An unsigned integer (octal).
A pointer (address in hexadecimal).
|Caoilinn Hughes||Carcanet Press Ltd.|
|John F. Deane||Carcanet Press Ltd.|
|Mervyn Peake||Carcanet Press Ltd.|
|Joseph Albahari||O'Reilly Media||ePub|
Operators can be overloaded to provide more natural syntax for custom types. Operator overloading is most appropriately used for implementing custom structs that represent fairly primitive data types. For example, a custom numeric type is an excellent candidate for operator overloading.
The following symbolic operators can be overloaded:
Implicit and explicit conversions can also be overridden (with the
The compound assignment operators (e.g.,
An operator is overloaded by declaring an operator function. An operator function must be static, and at least one of the operands must be the type in which the operator function is declared.
In the following example, we define a struct called
Business & Economics