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

dynamic array

at this code https://www.sololearn.com/learning/1089/2950/6400/1 why all elemnts but the first one are zero ? while they all are in for loop ? what is the use of size and cap ? why in initialize cap =1 and zero = 0?

11th Nov 2022, 6:37 PM
Shimaa
Shimaa - avatar
1 Answer
0
"size" is the current size (length) of the array. "cap" is the current maximum capacity of the array.
18th Nov 2022, 10:01 PM
Vasile Eftodii
Vasile Eftodii - avatar