# Reference to a table before it appears

I want to reference a table before it appears.The TeX code is pasted below

\documentclass{article}
\begin{document}
The results given in Table~\ref{tab:a} show the  performance of
the class.

\begin{table}
\begin{center}
\begin{tabular}{lrc}\hline
Name & Mark & Grade \\
\hline
Prasad & 99 & A+ \\
Prakash & 51 & C\\
Shine & 5 & F\\ \hline
\end{tabular}
\caption{Class Mark List}\label{tab:a}
\end{center}
\end{table}
\end{document}


But the text

The results given in Table~\ref{tab:a} show the  performance of
the class.


is coming after the table. How can I put the table immediately after the text.

-
Is this a problem of where the table appears (float placement) or of referencing it? You can influence the placement of the table with a modifier \begin{table}[h]. (I believe the \label should go inside the \caption.) – Christian Lindig Feb 27 '11 at 10:24
@Christian: The \label just needs to go after the \caption. I can't think of any good reason to put it inside it. – TH. Feb 27 '11 at 10:34
possible duplicate of Why is my table displayed at the top of the page? – TH. Feb 27 '11 at 10:35
@Christian. I want the table to be referenced before and place the table immediately after the text. – Vinod Feb 27 '11 at 10:37

use it this way:

\begin{table}[!htb]
\centering
\begin{tabular}{lrc}\hline
....
\caption{Class Mark List}\label{tab:a}
\end{table}

-
 Thanks.[h] is also working. – Vinod Feb 27 '11 at 10:41 @Vinod: I know, but in other situations not and it is already modified internally to [ht] – Herbert Feb 27 '11 at 10:42