Initialization
Initialization is the process of establishing initial values or a starting state for a program entity, component, resource, or computation before subsequent operation.
Modern C
An initialization function is a function conventionally responsible for putting a supplied object into a valid initial state.
- How it is used
- Establishes a known initial state for objects, especially where allocated storage or variable-length arrays cannot use declaration initializers.
- How deep it goes
- Specifies naming, arguments, null handling, return values, and an element-by-element array routine; does not detail the internals of `rat_init`.
- Examples
- Uses scalar and designated array initializers, then `rat_init`, `rat_new`, and an array initialization loop.
- What you can do after
- Build it from scratch: define a consistent `_init` function and use it to initialize allocated objects or arrays.
Get Programming: Learn to code with Python
- How it is used
- Provides starting values for variables, loop counters, program inputs, and object attributes before they are used.
- How deep it goes
- Defines variable initialization as name binding and shows how `__init__` establishes object attributes through small Python examples.
- Examples
- Uses arithmetic variables, a minutes-conversion input, a loop counter, a circle’s radius, and an empty stack.
- What you can do after
- Build it from scratch by assigning starting values to variables and defining initial attributes in a class’s `__init__` method.
Read how Get Programming: Learn to code with Python explains initialization →
100 C++ Mistakes and How to Avoid Them
Initialization is the process of giving a C++ object its initial value or state when it is created.
- How it is used
- Uses initialization to prevent incorrect calculations, undefined reads, and objects that violate their class invariants.
- How deep it goes
- Explains declaration placement, primitive initialization, constructor initializer lists, validation, and exception-based construction, stopping short of broader language mechanics.
- Examples
- Demonstrates maximum over negative values, an uninitialized Person age, required constructor arguments, and validated Person construction.
- What you can do after
- Build it from scratch by placing initialization near use, requiring constructor state, validating arguments, and rejecting failed construction.
Read how 100 C++ Mistakes and How to Avoid Them explains initialization →
Modern C, Third Edition
Initialization is the process of providing an initial value for a C object as part of its declaration or creation.
- How it is used
- Establishes objects in a well-defined state when declarations or allocated storage bring them into existence.
- How deep it goes
- Descends from declaration syntax to storage-duration rules and initialization APIs, while deferring deeper object representations.
- Examples
- Uses scalar initialization, designated array elements, omitted zero values, and rat-specific initialization functions.
- What you can do after
- Apply initialization syntax and storage-duration rules, then design consistent initialization functions for allocated data types.
Natural Language Processing in Action, Second Edition
Initialization is the process of assigning starting values to a neural network’s states, weights, and biases before training.
- How it is used
- Uses starting hidden-state patterns to help recurrent networks learn temporal roles during sequence training.
- How deep it goes
- Explains hidden-state value choices, consistency, sample ordering, and risks of structured seeding without detailing initialization algorithms.
- Examples
- Uses zeros, ones, value gradients, consistent seeds, random shuffling, and alphabetized equal-length text samples.
- What you can do after
- Apply it by selecting repeatable hidden-state values and preserving effective sample randomization during recurrent-network training.
Read how Natural Language Processing in Action, Second Edition explains initialization →
Related concepts
- static storageconfigured by · Static storage duration is the storage duration of an object whose lifetime extends throughout program execution.
- storage durationconfigured by · Storage duration is the C property that determines how long an object exists during program execution and how its storage is managed.
- bindingconfigures · Name binding is the association of an identifier with the program entity or value it denotes.
- weightconfigures · A weight is a numerical quantity assigned to an element to represent its contribution, influence, importance, strength, or resource amount in a calculation or system.
- copy assignment operatorcontrasts with · A copy assignment operator is a C++ special member function that copies state from one object into an already existing object of a compatible type.
- arrayconfigures · An array is an indexed, ordered collection of elements arranged in one or more dimensions, with elements accessed by position.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




