Login Page - Create Account

Support Board


Date/Time: Thu, 13 Feb 2025 03:02:48 +0000



Post From: determining length of an array?

[2020-11-17 12:06:15]
ycomp - Posts: 321
i'm just declaring it like this before calling the function that I pass it to

int mas[] = { 2,3,4,5,6,7,8,9,10,11,12,13,14,15 };

I have many such arrays of different lengths so there is potential for error later if the code is modified and then length is miscounted and typed in wrongly as a parameter to the function. Currently I do count it visually and pass the length as a parameter but this just feels like really sloppy coding begging for problems in the future. I never realized it would be so hard to determine the length of an array in C++.. is there some standard library functions that can determine the size of any array? if so, how do I call standard library functions?
Date Time Of Last Edit: 2020-11-17 12:06:30