Skip to content

Commit f128968

Browse files
author
Colin Robertson
committed
Address cpp-docs issue 2584
1 parent a54a9d0 commit f128968

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

docs/cpp/arrays-cpp.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: "Arrays (C++)"
3-
ms.date: 08/03/2020
3+
description: "Learn how to declare and use the native array type in the standard C++ programming language."
4+
ms.date: 11/08/2020
45
helpviewer_keywords: ["declaring arrays [C++], about declaring arrays", "multidimensional arrays [C++]", "arrays [C++]"]
56
ms.assetid: 3f5986aa-485c-4ba4-9502-67e2ef924238
67
---
@@ -127,7 +128,7 @@ When an array is passed to a function, it's passed as a pointer to the first ele
127128
The following example shows a function that accepts an array and a length. The pointer points to the original array, not a copy. Because the parameter isn't **`const`**, the function can modify the array elements.
128129
129130
```cpp
130-
void process(double p*, const size_t len)
131+
void process(double *p, const size_t len)
131132
{
132133
std::cout << "process:\n";
133134
for (size_t i = 0; i < len; ++i)
@@ -137,10 +138,10 @@ void process(double p*, const size_t len)
137138
}
138139
```
139140

140-
Declare the array as const to make it read-only within the function block:
141+
Declare and define the array parameter `p` as **`const`** to make it read-only within the function block:
141142

142143
```cpp
143-
void process(const double p*, const size_t len);
144+
void process(const double *p, const size_t len);
144145
```
145146
146147
The same function can also be declared in these ways, with no change in behavior. The array is still passed as a pointer to the first element:

0 commit comments

Comments
 (0)