Logo

Programming-Idioms

History of Idiom 117 > diff from v38 to v39

Edit summary for version 39 by gpr:
[C] Correct type

Version 38

2017-09-27, 12:36:41

Version 39

2017-09-27, 12:37:26

Idiom #117 Get list size

Set n to the number of elements of list x.

Illustration

Idiom #117 Get list size

Set n to the number of elements of list x.

Illustration
Extra Keywords
length
Extra Keywords
length
Code
int n = sizeof(x)/sizeof(*x);
Code
size_t n = sizeof(x)/sizeof(*x);