
Long questions with answers for this topic
An array is a collection of same-type elements stored in contiguous memory locations.
The first index is 0.
A pointer is a variable that stores the address of another variable.
A C-style string is a character array terminated by '\0'.
delete[] releases memory allocated using new[] (dynamic arrays).
A dangling pointer points to memory that has already been freed.
A 1D array stores multiple values of the same type.
Declaration: int a[5];
Initialization: int a[5]={1,2,3,4,5};
Traversal uses a loop: for(i=0;i<5;i++) cout<<a[i];
Because elements are contiguous, indexing is fast.
Sign in to access the all questions and answers
It's free and takes just 5 seconds