confusedcoder
New Coder
Hi everyone!
I am very new to C programming having only started in September. I am trying to write a program that takes in n numbers of non-negative integers, places them into a dynamic array that grows in length as necessary and then uses a function to sort them in order of increasing size and print. I am trying to use a for loop to store each entry into the array and I have used an if condition in order to try and double the size using realloc as necessary. I understand the concept but I am struggling really hard and have already spent many hours at it but to no avail. Can anyone please help me by providing me with an example of some such similar code or point me in the right direction as I am almost at the end of my tether! Many thanks, C.
I am very new to C programming having only started in September. I am trying to write a program that takes in n numbers of non-negative integers, places them into a dynamic array that grows in length as necessary and then uses a function to sort them in order of increasing size and print. I am trying to use a for loop to store each entry into the array and I have used an if condition in order to try and double the size using realloc as necessary. I understand the concept but I am struggling really hard and have already spent many hours at it but to no avail. Can anyone please help me by providing me with an example of some such similar code or point me in the right direction as I am almost at the end of my tether! Many thanks, C.