#I believe I understand what the code does, but I don't understand why it does it (Beginner)

6 messages · Page 1 of 1 (latest)

neat mural
#

int rows = sizeof(numbers)/sizeof(numbers[0]);
int columns = sizeof(numbers[0])/sizeof(numbers[0][0]);

crystal waveBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

burnt briar
#

sizeof(arr) returns the size of the array in bytes

sizeof(arr[0]) returns the the bytes per row

sizeof(arr[0][0]) returns the size of one element (in bytes ofc)

#

assuming were working with a T arr[N][M] 2d array or array of arrays

the first one gives sizeof(T) * N * M
2nd one gives sizeof(T) * M
3rd sizeof(T)

neat mural
#

Okay that cleared it up in my head, thank you.

#

!solved