I have written a program that prints a table. I have not included the return syntax in the main function, but still whenever I type echo $? it displays 12.
My source
If you're at all familiar with assembly language, you may recall that the "return value" of a function is passed through the EAX register.
In this case, the return value is being read from EAX. Which, in this case, happens to be 12.
However, you're not explicitly setting this value, it's simply an artifact from the rest of the code (or perhaps just chance).
As has been said, this is definitely undefined behavior
. If you are simply curious why this results, please consider this explanation.
But do not, under any circumstances, attempt to intentionally use this value as anything meaningful.