Can you use arithmetic in declaration of an array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you use arithmetic in declaration of an array?

Hello everyone! I’m wondering if this is a valid declaration of an array: const int SIZE = 10; double list [20-SIZE];

13th Nov 2019, 4:41 PM
Heather Cook
Heather Cook - avatar
3 Answers
+ 6
Yes you can
13th Nov 2019, 4:43 PM
Kevin ★
+ 2
Yep. It is a valid declaration. As long as the size of list is positive, it is valid.
13th Nov 2019, 5:29 PM
Saurabh Tiwari
Saurabh Tiwari - avatar
+ 1
thank you guys!
13th Nov 2019, 9:52 PM
Heather Cook
Heather Cook - avatar