How to set a char array to a specific spot in a 2d char array

hi I have a 2d array that I want to set each element to a char array. how would I go about doing that.

char bdaylist[50][6];
this is my 2d array

my char array I'm trying to set each element to is
char charBuf[13];

in the charBuf variable has a string that is no more then 13 chars long and I convert it to a char array. then set it with this
bdaylist[row][col] = charBuf;

I don't know why I'm not getting the correct output in the 2d array all I get is � and blank chars can anyone help me.

here's birthday clock.ino (1.6 KB) my code.

please help

Doesn't IDE give you an error or at least a warning at this point?
The left side of this expression is of type char, the right side is a pointer to char.
Assigning one to the other will not do anything good

Use strcpy() or strncpy() to copy the char array into the right spot of the 2D array

Make sure you have enough space in the destination array

I’m reading this on my mobile and if I click on the link I get a prompt to download the file, could you please tell me why should I download your .ino file on my mobile?

how would i use strcpy() or strncpy() to set for instants with "bdaylist[0][1] = "?

you can't,
because bdaylist[0][1] is a single char and charBuf is a string up to 12 chars long

You should first calculate the pointer offset of the starting position where the contains of the charBuf should be copied and than use this pointer as destination parameter in strcpy()

then give me an example of how to set charBuf to a particular section of the 2d array.

strcpy(&bdaylist[0][1], charBuf, sizeof(charBuf));

thank you for the example that will help me.

Hum…

Use strncpy or strlcpy if you want to pass the size (better us the size of the destination to not overflow (mind the null)
you would need to take the address of index bdaylist[0][0]

You can just use the first part to get the address

strcpy(bdaylist[0], charBuf); // MAKE SURE THERE IS ENOUGH ROOM

It is true if you want to insert the buffer starting from first (zero-numbered) position of array row bdaylist[0][0]
But if I need to insert it from position bdaylist[0][1], as OP said - the only way that I see to do that will be follows:

strcpy(&bdaylist[0][1], charBuf, sizeof(charBuf));

or

strcpy(bdaylist[0] + 1, charBuf, sizeof(charBuf));

now im getting this error

C:\Users\ninte\OneDrive\Documents\Arduino\birthday clock\birthday clock.ino: In function 'void setup()':
C:\Users\ninte\OneDrive\Documents\Arduino\birthday clock\birthday clock.ino:39:61: error: cannot convert 'char ()[13]' to 'char' for argument '1' to 'char* strcpy(char*, const char*)'
strcpy(&bdaylist[row][col], charBuf, sizeof(charBuf));
^
C:\Users\ninte\OneDrive\Documents\Arduino\birthday clock\birthday clock.ino:51:61: error: cannot convert 'char ()[13]' to 'char' for argument '1' to 'char* strcpy(char*, const char*)'
strcpy(&bdaylist[row][col], charBuf, sizeof(charBuf));

Compilation error: cannot convert 'char ()[13]' to 'char' for argument '1' to 'char* strcpy(char*, const char*)'

try

strcpy(bdaylist[row] + col, charBuf, sizeof(charBuf));

same error what am I doing wrong.

Why are you using a 2D array? If you have a 2D array where each element is also an array, isn't that just a 3D array?

Please show all your code

i guess you are right it is a 3d array each row has up to 6 elements and each Column has 50 sets of 6 rows and each element has up to 13 chars in it.

can you help me with my error I'm been trying strncpy but I have to shorten my 3d array to bdaylist[2][6][13];. I need to store more then 2 columns of info.

so please help.

i shared my code in my first post. its the link. that is the old code.

the new code is me trying different things like strnpy(bdaylist[row][col], charBuf, sizeof(charBuf));

Please insert your latest code to the forum in code tags

This is an illustration of why it is necessary to correctly describe the task and always show the full code.
You confused yourself and others and they wasted time on you
Good luck