Answers for "arduino get index of array"

0

arduino get index of array

const int arysz = 6;
int ary[arysz] = {4, 32, 6, 2, -1, 5}
int wantedval = -1;
int wantedpos;
for (int i=0; i<arysz; i++) {
   if (wantedval = ary[i]) {
     wantedpos = i;
     break;
   }
}
Posted by: Guest on October-02-2021

Browse Popular Code Answers by Language