Go Down

Topic: handing over byte array to function via pointer (Read 983 times) previous topic - next topic

robvoi

Hi,

I try to manipulate a (non global) byte array by using another function.
As far as I understood I can't hand over and return the array. I have to do it via a pointer.

So I tried it based on an example out of this thread: http://arduino.cc/forum/index.php/topic,42934.0.html

My code:
Code: [Select]
void download ()
{
byte buf[32];
rgbTo8Bit(&buf);
}

void rgbTo8Bit (byte *pbuf){
pbuf[0]=pbuf[1]/2 //just dummy code
}


The error I get when compiling is:
error: no matching function for call to 'rgbTo8Bit(byte (*)[32])'
note: candidates are: void rgbTo8Bit(byte*)

I don't get what is wrong. Can't I reference to an array like this?

Thanks
Robert

SurferTim

If you do not use an array index, it is already a pointer.
Code: [Select]
rgbTo8Bit(buf);

robvoi

Thanks a lot for the swift and workling anser.  :)

Robert

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy