Skip to content

Commit a61daf8

Browse files
concepts/vector-arrays: fix examples (#988)
1 parent ec14dfa commit a61daf8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

concepts/vector-arrays/about.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Arrays also need a size.
1212
Look at these examples to see the two container types' initializations:
1313

1414
```cpp
15-
#include<array>
15+
#include <array>
1616
#include <string>
1717

18-
// std::array variable_name<element_type, size> {list of elements}
18+
// std::array<element_type, size> variable_name {list of elements}
1919
std::array<std::string, 3> indie_rock {"yeah", "yeah", "yeah"};
2020
// indie_rock contains the elements "yeah" three times
2121
```
@@ -24,10 +24,10 @@ Vectors usually need more space, as they allocate memory for further growth.
2424
You do not need to specify a size:
2525
2626
```cpp
27-
#include<vector>
27+
#include <vector>
2828
29-
// std::vector variable_name<element_type> {list of elements}
30-
std::vector countdown<int> {3, 2, 1};
29+
// std::vector<element_type> variable_name {list of elements}
30+
std::vector<int> countdown {3, 2, 1};
3131
// my_vector contains the elements 3, 2 and 1
3232
```
3333

concepts/vector-arrays/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Look at these examples to see the two container types' initializations:
1515
#include <array>
1616
#include <string>
1717

18-
// std::array variable_name<element_type, size> {list of elements}
18+
// std::array<element_type, size> variable_name {list of elements}
1919
std::array<std::string, 3> indie_rock {"yeah", "yeah", "yeah"};
2020
// indie_rock contains the elements "yeah" three times
2121
```

0 commit comments

Comments
 (0)