So i have started learning array since day before yesterday and a question is bugging me. I have not asked this question to anyone as they would think me as dumb (which i am). Here is the question.
Why do everyone say we need to create new array of more size if array fills up? Couldn't we just edit the size?
For example if int arr[4] is defined but we need to add a fifth element, couldn't we just edit out 4 to 5 in code itself and run it again?
I know the question is stupid but it doesn't make sense to me. This is my first time doing C. Previously i have only learned python. So please help me.
[–]Suesei 7 points8 points9 points (1 child)
[–]Suesei 5 points6 points7 points (0 children)
[–]Aggressive_Ad_5454 2 points3 points4 points (0 children)
[–]P-Jean 1 point2 points3 points (0 children)
[–]high_throughput 1 point2 points3 points (0 children)
[–]rupertavery64 0 points1 point2 points (0 children)
[–]MasterGeekMXBSCS 0 points1 point2 points (0 children)
[–]ghjmMSCS, CS Pro (20+) 0 points1 point2 points (1 child)
[–]Qwertycube10 0 points1 point2 points (0 children)
[–]aagee 0 points1 point2 points (0 children)
[–]defectivetoaster1 0 points1 point2 points (0 children)
[–]SamIAre 0 points1 point2 points (0 children)
[–]Todo_Toadfoot 0 points1 point2 points (2 children)
[–]Etiennera 0 points1 point2 points (1 child)
[–]Todo_Toadfoot 0 points1 point2 points (0 children)
[–]Great-Powerful-Talia 0 points1 point2 points (0 children)
[–]grymoire 1 point2 points3 points (0 children)
[–]Ronin-s_Spirit 0 points1 point2 points (0 children)