liveBook · Manning

Value

As explained in Modern C, Third Edition

A value is the data represented by an object or expression at a particular point in program execution.

A C value is an abstract entity, distinct from the program, its implementation, and the value’s representation during execution. For example, zero has the same effects across C platforms: adding it to x leaves x unchanged, and using it in a control expression selects the false branch. section 5.1.1

Keep a variable’s object (the storage), type, value (its contents), and identifier (its name) distinct. Expressions can also produce intermediate values without storing them in objects. Program data consists of the values of all objects at a given moment. section 2.2 section 5.1.1

double x = 5.0;
double y = 3.0;
...
x = (x * 1.5) - y;
printf("x is %g\n", x);

In this example, x and y supply values to intermediate expressions; the assignment gives x the value 4.5, which printf then outputs. The intermediate results need not themselves be stored or observable. section 5.1

C programs should primarily reason about values rather than concrete representations. Representations can vary across architectures or with type, so focusing on values supports portable reasoning; the compiler translates between values and representations. section 5.0

How Modern C, Third Edition covers it

How deep it goes
Defines values as abstract entities and traces intermediate expression results through assignment and output.
Examples
Uses zero’s consistent effects and a floating-point expression that assigns and prints the value 4.5.
What you can do after
Understand program execution by tracking values through objects and intermediate expressions without depending on their concrete representations.
How it connects
Connects values to objects, types, expressions, program data, and C’s abstract state machine.

Also explained in

Compare how 7 books explain value →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C, Third Edition. The section links point to the parts of the book it draws on.