Define array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Define array

21st Dec 2017, 6:32 PM
saurabh yadav
saurabh yadav - avatar
5 Answers
+ 3
What are you speaking about? write a more specific question! so that people can understand you, or look at this post ↓↓↓ :) https://www.sololearn.com/Discuss/321242/?ref=app
21st Dec 2017, 6:35 PM
James16
James16 - avatar
+ 21
set of similiar entries (having similiar datatype) //generally used when we take multiple inputs or any other need to store multiple variables or constants of same type ☺
21st Dec 2017, 7:51 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 5
array is a collection of similar type datatypes for define an array you should write syntax like this:- datatype array_name[array_size]; an example of array #include<iostream> int y[10]; void doSomething() { int x[10]; int *z = new int[10]; //Do something interesting delete []z; } int main() { doSomething(); } int x[10]; - Creates an array of size 10 integers on stack. - You do not have to explicitly delete this memory because it goes away as stack unwinds. - Its scope is limited to the function doSomething() int y[10]; - Creates an array of size 10 integers on BSS/Data segment. - You do not have to explicitly delete this memory. - Since it is declared global it is accessible globally. int *z = new int[10]; - Allocates a dynamic array of size 10 integers on heap and returns the address of this memory to z. - You have to explicitly delete this dynamic memory after using it. using: delete[] z;
21st Dec 2017, 6:41 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 2
Best answer - ARRAY is a set of similar elements what you exactly want to know?
21st Dec 2017, 7:05 PM
prachal goyal
prachal goyal - avatar
0
check this https://www.sololearn.com/learn/CPlusPlus/1625/?ref=app dude don't forget to slide there are 3 pages
21st Dec 2017, 6:37 PM
Hack Erer
Hack Erer - avatar