Passing Arrays as arguments into custom void function.
strange things dont understand going on snippet of code. subject hints to. created custom function accept int low number, int increment, , int array. if want find size of array sizeof(yourarray)/ sizeof(arraytype) works if run on first array declared out of setup , loop. if try pass array custom function. shabam. internet breaks. yeah not dramatic doesn't give expected result. best can figure. since in c name of array address first element of array, , element used in calculation of sizeof() function. why though question.
code: [select]
int temparray[] = {1, 2,3,4,5,6}; //pass array function below
void makeboundarray(int low, int inc, int array[]) {
int x = sizeof(array) / sizeof(int); returns 1
(int = 0; < x; = + 1) {
array[i] = (low +( * inc));
}
in code posted there no point @ makeboundarray called. suspect problem; never call makeboundarray.
Arduino Forum > Using Arduino > Programming Questions > Passing Arrays as arguments into custom void function.
arduino
Comments
Post a Comment