How does each element in the output array of a DFT correspond to a specific frequency?
Let us denote the input signal by $x(0),\ldots,x(n-1)$ and the output signal by $y(0),\ldots,y(n-1)$. Your program is using the following formula:
$$
y(k) = \sum_{t=0}^{n-1} e^{-2\pi i tk/n} x(t).
$$
We also have
$$
x(t) = \frac{1}{n} \sum_{k=0}^{n-1} e^{2\pi i tk/n} y(k).
$$
In other words, any input signal can be represented as a linear combination of the functions $\chi_k(t) = e^{2\pi i tk/n}$, and the output signal gives the coefficients of this representation (up to a normalization factor).
The parameter $k$ is analogous to frequency. You can see the analogy more clearly if you write
$$
\chi_k(t) = \cos \frac{2\pi k}{n} t + i \sin \frac{2\pi k}{n} t.
$$