I'm making a table with the following code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\title{Answer}
\author{That's me}
\date{March 2018}
\setlength{\parindent}{0pt}
\begin{document}
\maketitle
\begin{table}[h!]
\centering
\begin{tabular}{||c c c c c||}
\hline
Instruction & Mode & \#cycles without prefetch & \#cycles with prefetch & \#memory accesses \\ [0.5ex]
\hline\hline
ADD $R_i$ expr & 6 & 87837 & 787 & pototo \\
LOAD $R_i$ [expr] & 7 & 78 & 5415 & pototo\\
XOR $R_i$ [expr] & 545 & 778 & 7507 & pototo\\
STOR $R_i$ [expr] & 545 & 18744 & 7560 & pototo \\
BEQ disp (not taken) & 88 & 788 & 6344 & pototo \\
BEQ disp (taken) & 88 & 788 & 6344 & pototo\\ [1ex]
\hline
\end{tabular}
\caption{Table to test captions and labels}
\label{table:1}
\end{table}
\end{document}
But getting the following error \hbox (124.69516pt too wide) and therefore the table isn't showing.
I checked these two questions but the solution didn't work for me. This one and This one
Edit: the whole code so that Phelype Oleinik can check it:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\title{Answer}
\author{That's me}
\date{March 2018}
\setlength{\parindent}{0pt}
\newcommand{\tblmultiline}[2][c]{\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
\begin{document}
\pagenumbering{gobble}
\maketitle
\textbf{2.1.b)} normal text
\\
\textbf{2.1.c)} Normal text
\\
\textbf{2.1.d)} Normal text and some code. Here's the code: \\
SigmaA $<-$ IR.val(Bbus) \\
\{ SigA = IR.val \} \\
SigmaR $<-$ RAM[SigmaA] \\
\{ SigA = IR.val, SigR = RAM \} \\
SigmaW, CC $<-$ RA(Abus) + SigmaR(Bbus), ALU.cc \\
\{ SigA = IR.val, SigR = RAM[IR.val], CC = ALU.cc, SigW = RA+RAM[IR.val]\} \\
RAM[SigmaA] $<-$ SigmaW \\
\{RAM[IR.val] = RAM[IR.val] + RA \} \\
\textbf{2.3.c)}
\begin{table}[h!]
\centering
\begin{tabular}{||c c c c c||}
\hline
Instruction & Mode & \tblmultiline{\#cycles\\without\\prefetch} & \tblmultiline{\#cycles\\with\\prefetch} & \tblmultiline{\#memory\\accesses} \\ [0.5ex]
\hline\hline
ADD $R_i$ expr & 6 & 87837 & 787 & pototo \\
LOAD $R_i$ [expr] & 7 & 78 & 5415 & pototo\\
XOR $R_i$ [expr] & 545 & 778 & 7507 & pototo\\
STOR $R_i$ [expr] & 545 & 18744 & 7560 & pototo \\
BEQ disp (not taken) & 88 & 788 & 6344 & pototo \\
BEQ disp (taken) & 88 & 788 & 6344 & pototo\\ [1ex]
\hline
\end{tabular}
\caption{Table to test captions and labels}
\label{table:1}
\end{table}
\end{document}
I'm using sharelatex.com if that's relevant at all.
Best Answer
An "overfull hbox" basically means that something is extrapolating the text margins, in this case, the table. To save it you can increase the limit of extrapolation that TeX allows (not recommended), or shrink the faulty line (table) to fit in the margins.
Your table is too wide because of its headers. I used a
\tblmultiline
comman to split them into multiple lines to fit in the page: