why the program is taken with 2 dimensional array??

0 votes
asked Apr 25 by Naga Kiran Gadde (120 points)

1 Answer

0 votes
answered Jul 14 by xDELLx (2,430 points)
char info[15][15]; // 2 dimensional array is used since u need to store multiple strings in a single place.

Single dimension (char) array store a bunch of characters in contiguous memory locations & create a string.

Now since we need to store a bunch of strings (1-dimensinal array) in contiguous memory locations , we need another dimension to the array.

Also since you are already using c++ , I would suggest to use std::strings as its more high-level than raw strings & more work-able in code
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.