Hello to all.
I have a problem in coding.
I want to create a function that returns 5 byte of char.
But I don't know how to do.
My wrong code is the same as below.
Please Help,thanks.
void loop()
{
Serial.print(aaa());Â Â Â Â
}
char aaa()
{
char b[]={0};
b[0]="H";
b[1]="E";
b[2]="L";
b[3]="L";
b[4]="O";
  return b;
}
You should use single quotes to assign a value to a char
There is no terminating zero on the array so you cannot safely print it if that is what you want to do.
Try this
char b[6] = {0};Â //allow room for the terminating zero
void setup()
{
 Serial.begin(115200);
 aaa(b);
 Serial.println(b);
}
void loop()
{
}
void aaa(char b[])
{
 b[0] = 'H';
 b[1] = 'E';
 b[2] = 'L';
 b[3] = 'L';
 b[4] = 'O';
 b[5] = '\0';
}
The function does not need to return a value because the array has been modified directly
Okay,
My real purpose is I wanna use Wire.read() function in another header, and it should return me Data.
And I want to use Data in my program.
That was my problem,
Thanks for taking your time.