Problem description:
When initilaising an empty 2D jagged array in C, and outputting it’s contents without changing any of it’s values, a collection of hexadecimal values can be seen. These values seem to be dependent on other unrelated components of the code. For instance, adding a print statement prior to outputting the array’s contents will somehow change the contents of the array.
I decided to output it’s contents in the hex format out of curiosity and the values seemed significant enough for me to do some further testing.
Some relatively common values output are the hexadecimal numbers 0, 1, 100, 404, 6e0000, 528000 and ffffffff.
I can’t seem to work out any correlation between these values and the changes I make the the code.
Expected behavior:
Jagged array contains only 0s after being initialised.
Actual behavior:
Jagged array contains a variety of hexadecimal values after being initialised.
Steps to reproduce:
In C, declare a 2D jagged array with a known size and without defining any values. Then output the contents of the array.
Bug appears at this link:
2018 - Byway (C) (1) - Replit
Browser: Microsoft Edge
OS: Windows 11
Desktop app version (Avatar menu->“Version”) or NA: NA
Plan (Free, Hacker, Pro Plan): Free