hello guys, salam arduino
how to read many array using variable int..
Please give an example of what you want to do
Are there many arrays or a single array with many entries ?
I wanna count my array this is my program example thankyou
int house[] = {1,13,15,16,17,3,19,20};
int countarrayhouse;
void setup(){
Serial.begin(9600);
Serial.println (countarrayhouse)
}
void loop(){}
which is actually my array very much number
Do you just want to count how many entries there are in the array or perhaps total the values in the array ?
The classical way would be:
int house[] = {1, 13, 15, 16, 17, 3, 19, 20};
int countarrayhouse = sizeof(house) / sizeof(house[0]);
[edit]
Or my personal favorite:
template <class T, size_t n> size_t arraySize(T const (&)[n]) { return n; }
int house[] = {1, 13, 15, 16, 17, 3, 19, 20};
int countarrayhouse = arraySize(house);
3 Likes
just how many entries my array
But you must already know how many entries there are in the array in order to declare it
What are you really trying to do ?
thank you my problem SOLVED
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.