# Tabular environment display very weird

So, to draw a table, I use the following Latex Code:

\begin{tabular}{|c|c|}
$p$ & $\bar{p}$\\
\hline\\
1 & 0\\
0 & 1
\end{tabular}


But somehow, this is the outcome

• Leave out the \\ after \hline – CarLaTeX Jan 16 '18 at 14:49
• You're welcome! I think you could delete your question. – CarLaTeX Jan 17 '18 at 4:35
• There are two other "mistakes" in case of a formal table for a serious journal: (1) Vertical lines. Avoid it! (2) \hline. Use \toprule,\bottomrule and \midrule instead of \hline for horizontal rules (need the the package booktabs in the preamble). – Fran Jan 17 '18 at 5:26

Putting a \\ after the \hline is like you are writing a row with empty cells.

The vertical line at the end of the empty row would appear if you wrote & \\, but of course you do not want an empty row, so simply leave out the \\.

\documentclass{article}

\begin{document}
\begin{tabular}{|c|c|}
$p$ & $\bar{p}$\\
\hline\\
1 & 0\\
0 & 1
\end{tabular}

A table with an empty row:
\begin{tabular}{|c|c|}
$p$ & $\bar{p}$\\
\hline
&\\
1 & 0\\
0 & 1
\end{tabular}

The correct table:
\begin{tabular}{|c|c|}
$p$ & $\bar{p}$\\
\hline
1 & 0\\
0 & 1
\end{tabular}
\end{document}