How to get the dimension/bounds of an array?
Consider: #define BOUNDS(array) sizeof(array) / sizeof(array[0]) // … char buf[99]; // …size_t is from stddef.h in C, cstddef in C++ size_t bd = BOUNDS(buf); In C++ you might do this: #include
Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.
Consider: #define BOUNDS(array) sizeof(array) / sizeof(array[0]) // … char buf[99]; // …size_t is from stddef.h in C, cstddef in C++ size_t bd = BOUNDS(buf); In C++ you might do this: #include