Right now, I have the code below that makes this
However, I'd like to illustrate that a 2D array is an array of arrays.I'd like to put a unique string inside the boxes such as "[3, 1, 4, 1, 5]", "[2, 4, 6, 8, 10]", etc. I want to have full control of the strings inside the boxes.
Any help is appreciated!
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcounter{index}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\setcounter{index}{0}
\coordinate (s) at (0,0);
\foreach \num in {3, 1, 4, 1, 5}{
\node[minimum size=6mm, draw, rectangle] at (s) {\num};
\node at ($(s)-(0,0.5)$) {\theindex};
\stepcounter{index}
\coordinate (s) at ($(s) + (1,0)$);
}
\end{tikzpicture}
\label{fig:testArray}
\end{figure}
\end{document}

