Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How would I take seperate characters given by a 2d array and put them together a

ID: 3784400 • Letter: H

Question

How would I take seperate characters given by a 2d array and put them together as one string?
example below:
printf("%c", grid[4][2]) which prints out H printf("%c", grid[2][1]) which prints out I
How would I put grid[4][2] and grid[2][1] together to make the string Hi? I don't just need to print it out, I need to put together an actual string.Again, I don't need to print this but store it as a seperate char string.
Any help would be greatly appreciated, will rate. Thank you How would I take seperate characters given by a 2d array and put them together as one string?
example below:
printf("%c", grid[4][2]) which prints out H printf("%c", grid[2][1]) which prints out I
How would I put grid[4][2] and grid[2][1] together to make the string Hi? I don't just need to print it out, I need to put together an actual string.Again, I don't need to print this but store it as a seperate char string.
Any help would be greatly appreciated, will rate. Thank you How would I take seperate characters given by a 2d array and put them together as one string?
example below:
printf("%c", grid[4][2]) which prints out H printf("%c", grid[2][1]) which prints out I
How would I put grid[4][2] and grid[2][1] together to make the string Hi? I don't just need to print it out, I need to put together an actual string.Again, I don't need to print this but store it as a seperate char string.
Any help would be greatly appreciated, will rate. Thank you

Explanation / Answer

See this is a static requirement you can do like this

you can create a char array of size 2 to accomodate the 2 characters like shown below :

char final_str[2]; // create char string
final_str[0]=grid[4][2]; // assign first character
final_str[1]=grid[2][1]; //assign second character

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote