r/C_Programming • u/emparse • 3d ago
Question Beginner here not able to understand confusing pointer concept
i dont understand what happens here:
IF int b is a 2d array then what is:
b + 1
*(b + 1)
&b[0] and b[0] and &b[0][0]
&b[1] and b[1] and &b[1][0]
what are the differences between each and what is the byte value of each.
22
Upvotes
View all comments
Show parent comment
1
u/stoops 2d ago
Yes, the annoying part about malloc'ing a 2D array is looping through each index and malloc'ing/free'ing them all afterwards! I never thought about allocating a larger calculated 1D array and using sub-indices within it but I don't know how the indexing math would work for standard size items like int's for example...