Principially you have two possibilities to add captions to a table (same works for figures too with figure instead table):
- You can use a non floating table (that means you do not use environment
table, which makes the table floating) as shown in the first example of the following MWE, nearly the same you used in your code. Then you need to use command \captionof{table}{} to get a table caption for your table outside a float (you see the relevance to the error message you got?).
- You can use a floating table with environment
table. That means LaTeX is allowed to place the table inside the document at a place at its own. Usually that means the table is placed at the top of the page (as done in my MWE) or at the top of the next page ...
Then you need to use command \caption{} to get a table caption ...
Please see the following MWE
\documentclass{article}
\usepackage{caption} % <================================================
\usepackage{booktabs} % <================================= better tables
\usepackage{blindtext} % <======================= to generate dummy text
\begin{document}
\begin{minipage}[c]{\linewidth}
\centering % <====================================== to center the table
\begin{tabular}{c| c c c}
Campus & Main & Jubilee & Kings Meadow \\ [0.5ex]
\hline
Main & 0 & 21.8 & 24.6 \\
Jubilee & 21.8 & 0 & 9.3 \\
Kings Meadow & 24.6 & 9.3 & 0 \\
\end{tabular}
\captionof{table}{Table Description} % <================== from package `caption`
\label{tab:campus} % <============================== to be referenacable
\end{minipage}
\blindtext
\begin{table}%[ht] % <====================================== let table float!
\centering
\begin{tabular}{c c c c}
\toprule % <====================================== from package booktabs
Campus & Main & Jubilee & Kings Meadow \\ [0.5ex]
\midrule % <====================================== from package booktabs
Main & 0 & 21.8 & 24.6 \\
Jubilee & 21.8 & 0 & 9.3 \\
Kings Meadow & 24.6 & 9.3 & 0 \\
\bottomrule % <=================================== from package booktabs
\end{tabular}
\caption{Table Description a}
\label{tab:campusa}
\end{table}
Now we can reference table~\ref{tab:campus} and table~\ref{tab:campusa}.
\end{document}
and its result:

As you can see table two is floating at the top of the page, has a caption and is referencable as you can see in the last sentence. You can also see that I used package booktabs for better horizontal lines and I deleted the vertical line (try to do not use them!) in the second table.
If you do not want the table to float at the top of the same page you can try to use option [ht] for table environment:
\begin{table}[ht] % <====================================== let table float!
If you remove the % before [ht] in the MWE above you get the changed result:

BTW: Have you considered to write the numberes aligned to the dezimal point? Numbers in tables looks better then IMHO. See package dcolumn or siunitx ...
\captioncommand outside of atableorfigureenvironment. – leandriis Sep 05 '19 at 12:10tabularand\captionwith atableenvironment (and replace thecenterenvironment with the\centeringcommand). – leandriis Sep 05 '19 at 12:10tableenvironment, you can add a caption to atabularbut the table will not necessarily show up exactly where you specified it in your code. – leandriis Sep 05 '19 at 12:23\captionoffrom the caption or capt-of packages. If I had designed LaTeX, I would have combinedfigureandtableintofloatand used\captionoffor both. – John Kormylo Sep 05 '19 at 14:50