Setting a Array to 0 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Setting a Array to 0

Hello, can I in some way set an array=0? int array[]={0}; Works fine to set every value of the array =0, but when i use it inside the programm without the 'int' it won't work? Any ideas why?

27th Nov 2019, 12:48 PM
Martin Stave
Martin Stave - avatar
3 Answers
+ 4
The first element of an array is termed with array[0], but your question requires more description
27th Nov 2019, 6:10 PM
NightFox
NightFox - avatar
+ 1
Where is your program?
27th Nov 2019, 1:13 PM
A͢J
A͢J - avatar
+ 1
Did you mention array[0] while using in your program? Since it has only one element inside it. You can also use a pointer variable to access it. For eg --> int *a = array;
27th Nov 2019, 1:14 PM
Avinesh
Avinesh - avatar