Why is the following code showing an error? Explanation needed. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is the following code showing an error? Explanation needed.

https://code.sololearn.com/ctALWkYbEnjK/?ref=app

26th Jan 2023, 5:23 AM
King
King - avatar
1 Answer
+ 5
It's better to initialise like this it will take size automatically according to elements int arr[] = {1,2,3,4,5}; problem is that you cannot use a <brace-enclosed initializer list> to initialize an array only while declaration. either you initialise it in same line or use loop
26th Jan 2023, 6:17 AM
A S Raghuvanshi
A S Raghuvanshi - avatar