Make your own eBooks

Use our Remix App to mix & match content. In minutes make your own course packs, training bundles, custom travel guides, you name it. Even add your own title & cover.

Education
Research
Travel
Health

Slices & Articles Get by the slice or add to your own ebook

Medium 9781449303709

Formatted Printing

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.

%b

An unsigned integer (binary).

%c

The character corresponding to the ordinal value.

%d

A signed integer.

%e

A floating-point number (scientific notation).

%f

A floating-point number (fixed decimal notation).

%g

A floating-point number (%e or %f notation).

%i

A synonym for %d.

%n

The number of characters formatted so far is stored into the corresponding variable in the parameter list.

%o

An unsigned integer (octal).

%p

A pointer (address in hexadecimal).

%s

See All
Medium 9781847772626

Marbles

Caoilinn Hughes Carcanet Press Ltd. PDF
Medium 9781847771179

The Fox-God

John F. Deane Carcanet Press Ltd. PDF
Medium 9781847779694

How Mournful to Imagine

Mervyn Peake Carcanet Press Ltd. PDF
Medium 9781449394011

Operator Overloading

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 implicit and explicit keywords), as can the literals true and false, and the unary + and operators.

The compound assignment operators (e.g., +=, /=) are automatically overridden when you override the noncompound 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 Note, representing a musical note, and then overload the + operator:

See All

See All Slices