0

How would i enter an unlimited input from the user into a dynamic memory malloc array? Needed in c language.

I need this without entering the amount that i want to input. How would i do this? Can you show me an example pls?

23rd Oct 2021, 6:03 PM
Kareem Idris
2 Antworten
+ 4
Use while loop and just pass bool value it will ask for input again an again but u need to set any base condition for exit otherwise your program can be crash
23rd Oct 2021, 6:06 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
After the initial call to malloc you can use realloc to increase the size as needed.
24th Oct 2021, 1:53 AM
Brian
Brian - avatar