Char, Byte, Array, strings

hi all iam looking for some help

i have this Byte Array and i want to convert it to spell the word "arduino"

byte CharByteArray={97, 114, 100, 117, 105, 110, 111};

can somone help me i gess iam missing one line on code or something more fundamental

the kind of thing iam looking for is the char equivalent of atoi();

thanks for the help
jim

I don't understand what you mean by "spell".
The char bytes are the letters 'a', 'r', 'd', 'u', 'i', 'n', 'o'

.

Tell the compiler you want to print the contents as characters with a cast.

[color=blue]Serial.print((char)CharByteArray[j]);[/color]

This example uses a char pointer to loop through an array to print the contents. No need to worry about the length of the string as long as it does not exceed ByteArray-1, when it sees the terminator it knows its reached the end of the string.

byte ByteArray[20];

void setup() {
 Serial.begin(9600);
}

void loop() {
  
 example();
 delay(1000);
 
}

void example() {
  
memset(ByteArray,0,sizeof(ByteArray));  //Clean out the contents of ByteArray and initialize all elements to zero

ByteArray[0]=97;   //a
ByteArray[1]=114;  //r
ByteArray[2]=100;  //d
ByteArray[3]=117;  //u
ByteArray[4]=105;  //i
ByteArray[5]=110;  //n
ByteArray[6]=111;  //o
       
 const char *pointer;
          pointer = ByteArray;   //ByteArray is the address of the first element
    while (*pointer) {           //While the pointer is not a terminator ('\0') then print each element of the ByteArray
          Serial.print(*pointer);
          pointer++;             //Increment pointer
               }
 Serial.print('\n');             //Comment this line if you do not need a line feed
}

hi all thank you all the your help it has allowed me to carry on with my project

If you’re doing it programmatically

strcpy(CharByteArray, “arduino”);

dougp:
Tell the compiler you want to print the contents as characters with a cast.

[color=blue]Serial.print((char)CharByteArray[j]);[/color]

Do note that (and some other example here) has a big flaw! The original 'CharByteArray' is not NULL terminated so that will fail with random outcome.