From 9a10046c2f47541bcb80a3c44180c62df17891f6 Mon Sep 17 00:00:00 2001 From: Ishita Bansal <42008217+dramish@users.noreply.github.com> Date: Thu, 20 Dec 2018 12:33:05 +0530 Subject: [PATCH] Add "Difference between array and pointer" (#24541) --- guide/english/cplusplus/arrays/index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guide/english/cplusplus/arrays/index.md b/guide/english/cplusplus/arrays/index.md index 8471736bc4a..5adb24bd439 100644 --- a/guide/english/cplusplus/arrays/index.md +++ b/guide/english/cplusplus/arrays/index.md @@ -51,6 +51,10 @@ numbers[2] = 55; // Sets the third position (index 2) to the new value 55 //numbers[] is now: {1, 2, 55, 4, 5} ``` +### What is the difference between arrays and pointers? +An array is a collection of variables of similar data type that are stored in contiguous memory locations whereas the pointer is a variable that stores the memory address of another variable i.e. a pointer is a variable that points to the location of another variable. + + How to insert and print array elements: ```C++ int vnum[5] = {1, 2, 3, 4, 5}