Tikz: Zero-padding node labels?

Adapting the PGF answer given here: How to output a counter with leading zeros? we can use the same approach with your example. Instead of using \pgfmathtruncatemacro I've use \pgfmathsetcounter and then used the base conversion to pad the zeros.

\documentclass{article}
\usepackage{tikz}
\newcounter{nodelabel}
\begin{document}
\begin{tikzpicture}
  \def\n{10}
  \pgfmathsetbasenumberlength{3}
  \pgfmathparse{int(\n-1)}
  \foreach \x in {0,...,\pgfmathresult} {
    \foreach \y in {0,...,\pgfmathresult} {
      \pgfmathsetcounter{nodelabel}{\x + \y*\n}
      \pgfmathbasetodec\nodelabel{\the\value{nodelabel}}{10}%
            \node at (\x,\y) (\x) {c\nodelabel};
    }
  }
\end{tikzpicture}
\end{document}

enter image description here


Another solution with siuntix:

\documentclass{article}
\usepackage{siunitx}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \def\n{10}
  \pgfmathparse{int(\n-1)}
  \foreach \x in {0,...,\pgfmathresult} {
    \foreach \y [evaluate=\y as \ni using {int(\x+\y*\n)}] in {0,...,\pgfmathresult} {
            \node at (\x,\y) {c\num[minimum-integer-digits=3]{\ni}};
    }
  }
\end{tikzpicture}

\end{document}

enter image description here


Update:

I may have misunderstood the question, because labels can be written naturally like this:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \def\n{10}
  \pgfmathparse{int(\n-1)}
  \foreach \x in {0,...,\pgfmathresult} {
    \foreach \y in {0,...,\pgfmathresult} {
      \node at (\x,\y) (\x) {c0\y\x};
    }
  }
\end{tikzpicture}
\end{document}

Old answer:

You can use the macro \opprint from the xlop package that prints the numbers as they are written useless zeros included. For example 00000.000 will be written 00000.000

\documentclass{article}
\usepackage{tikz}
\usepackage{xlop}
\begin{document}
\begin{tikzpicture}
  \def\n{10}
  \pgfmathparse{int(\n-1)}
  \foreach \x in {0,...,\pgfmathresult} {
    \foreach \y in {0,...,\pgfmathresult} {
      \node at (\x,\y) (\x) {c\opprint{0\y\x}};
    }
  }
\end{tikzpicture}
\end{document}

array