Skip to content

How does initial allocation work for the stack example? #2075

Answered by lerno
pmcjones asked this question in Q&A
Discussion options

You must be logged in to vote

C3 uses zero initialization by default, so we'll always get it with zero size and capacity. Realloc can safely be used for the first allocation because if you pass null to realloc it essentially works as malloc.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@pmcjones
Comment options

@lerno
Comment options

lerno Apr 7, 2025
Maintainer

@pmcjones
Comment options

@lerno
Comment options

Answer selected by pmcjones
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants