How do I get the inputs in an array where the number of inputs is not known? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I get the inputs in an array where the number of inputs is not known?

22nd May 2018, 2:33 PM
Ramya S
Ramya S - avatar
3 Answers
22nd May 2018, 3:23 PM
🌛DT🌜
🌛DT🌜 - avatar
0
You can devide the size of the array with the size of object the array is. int arr [10]; sizeof(arr) / sizeof(int); //returns 10 It also works with dynamic arrays.
22nd May 2018, 4:14 PM
XiLef
- 1
Thank you... But in this program the size of the array is entered... There are some cases where the array size is not known...
22nd May 2018, 3:35 PM
Ramya S
Ramya S - avatar