Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3ca87fc

Browse files
Updating to C++23
1 parent 4d8245e commit 3ca87fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎05-arrays-pointers-and-loops.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Number and character arrays
44

5-
A C++ array can be described as a collection of entities *of the same type* and arranged *contiguously* in memory. C++ inherits its *built-in array* syntax from C, sometimes these are referred to as *C-style* arrays. Uniform initialization syntax can be used to assign the contents of an array at the point it is defined (and **only** at this point). This is called *aggregate initialization* using a *braced initializer* (the equals sign shown below is in fact optional):
5+
A C++ array can be described as a collection of entities *of the same type* arranged *contiguously* in memory. C++ inherits its *built-in array* syntax from C, sometimes these are referred to as *C-style* arrays. Uniform initialization syntax can be used to assign the contents of an array at the point it is defined (and **only** at this point). This is called *aggregate initialization* using a *braced initializer* (the equals sign shown below is in fact optional):
66

77
```
88
int numbers[] = { 1, 2, 3, 4, 5 };
@@ -167,7 +167,7 @@ int main() {
167167
}
168168
```
169169

170-
A few new things to notice about this program.
170+
A few new things to notice about this program:
171171

172172
* The size of the array called `str[]` is set by an integer constant, and this value is needed twice more in the program where it is accessible as `size(str)`, a compile-time value. An alternative way would be to use a constant or macro at each point the value is needed, and this is the only way to avoid repeated *magic constants* in older versions of C++ which did not provide `std::size()`.
173173

@@ -523,4 +523,4 @@ The following table lists all eight members of the `begin()`/`end()` family, whe
523523

524524
* Now modify the program so that only the last element of the array is printed out, whatever size the array is.
525525

526-
*All text and program code ©2019-2022 Richard Spencer, all rights reserved.*
526+
*All text and program code ©2019-2024 Richard Spencer, all rights reserved.*

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /