Stack in C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Stack in C

Hello, In C why do we want stack's push and pop functions? In examples there were not stack size control and how it happen, anyone can help me?

5th Jan 2019, 8:32 AM
GiGeNCo
GiGeNCo - avatar
2 Answers
+ 2
It doesnt have size control becsuse in stack you can store different types. Is better to use lists and do this sizeof(list)/sizeof(list[0]) for every list to find the size of elements in list.
5th Jan 2019, 5:02 PM
John Ds
John Ds - avatar
+ 1
Rewa Mathur Thank you, I saw such codes and I know how it work, I want to know why and when do we need to allocate stack memory.
6th Jan 2019, 9:41 AM
GiGeNCo
GiGeNCo - avatar