0

How to scan array 10 11 12 13 of unknown size in c language

8th Sep 2020, 2:14 PM
Mohan Raj Murugan
Mohan Raj Murugan - avatar
5 Respostas
+ 1
Mohan Raj Murugan What are 10,11,12,13 first? In which language do u want to scan?
8th Sep 2020, 2:24 PM
RuntimeERROR
RuntimeERROR - avatar
+ 1
Including string.h header allows access to the strlen() function that tells you length of given array, or you could write your own function to count elements in array, unfortunately you still need to have a predefined array with a specified size to fill and then hope the input is less. Other than that though if you want a truly dynamic array, you will have to follow Coder Kitten's answer. edit: link providing more info on memory allocation https://www.geeksforgeeks.org/dynamic-memory-allocation-in-c-using-malloc-calloc-free-and-realloc/
8th Sep 2020, 3:24 PM
StealthyTaco
StealthyTaco - avatar
0
In c
8th Sep 2020, 2:25 PM
Mohan Raj Murugan
Mohan Raj Murugan - avatar
0
Using a for loop u can do it!
8th Sep 2020, 2:28 PM
RuntimeERROR
RuntimeERROR - avatar
0
I don't it size how can we use for loop
8th Sep 2020, 2:29 PM
Mohan Raj Murugan
Mohan Raj Murugan - avatar