How to add a char to a particular index of the array.

For examples, if I have array

char array[] = {'A', 'R', 'D'}

What I want to ask is what do I want to do if I want to add "U" to the index 3 of the array.

So the array will become

char array[] = {'A', 'R', 'D', 'U'}

Will this work:

char array[3] = {'U'}

Or I need to do something else. Thank You!

You originally declared the array as being 3 chars long, so you can't write a fourth character to it.

You could do this:- char array[4] = {'A', 'R', 'D'} array[3]='U';

Try this out:-

void setup()
    char array[4] = {'A', 'R', 'D'};

void loop(){}