Can I have an array as an argument for a void function?
i'm working 17-segment (or in case 16-segment because i'm taking out decimal point make things easier) alphanumeric led displays, , want have code can change array in calling displaystring function , interpret , display on leds.
this code defines function:
and here part call function:
and when verify program, following
error: expected primary-expression before '{' token
i've tried different syntax calling it, none of worked, problem lies , it's thing can think of causing error. so, ultimately... know syntax doing this?
this code defines function:
code: [select]
void displaystring(int string[]){
//there functions in here 74hc595 shift
//registers driving segments well
clearregisters();
for(int = 0; < sizeof(string); i++){
switch(string[i]){
case 'a':
//i defined lists named a-z pins of the
//display should lit according character
for(int x; x < sizeof(a); x++){
setregisterpin(a[x] + (i * 16), high);
}
case 'b':
for(int x; x < sizeof(b); x++){
setregisterpin(b[x] + (i * 16), high);
}
//etc...
}
}
writeregisters();
}
and here part call function:
code: [select]
void loop(){
displaystring ({'a', 'b'});
delay(10);
}
and when verify program, following
error: expected primary-expression before '{' token
i've tried different syntax calling it, none of worked, problem lies , it's thing can think of causing error. so, ultimately... know syntax doing this?
nope, cannot pass arrays in c. have create variable. if defined accept char array, pass "ab".
Arduino Forum > Using Arduino > Programming Questions > Can I have an array as an argument for a void function?
arduino
Comments
Post a Comment