[C/C++] Dynamically allocating 2D array in C

main: malloc.c:2405: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize – 1)) == 0)’ failed.
This most likely means that there is a mistake regarding usage of “sizeof”

Reference

Various methods to allocate 2D array: https://www.geeksforgeeks.org/dynamically-allocate-2d-array-c/
Common mistake: https://stackoverflow.com/questions/46803671/sysmalloc-assertion

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.