From the bash manual, on the $? variable:
$?Expands to the exit status of the most recently executed foreground pipeline.
I wonder why bash updates the $? variable on pressing Ctrl-C or Ctrl-Z:
$ echo $?
0
$ ^C
$ echo $?
130
$ sleep 10
^Z
[1]+  Stopped                 sleep 10
$ echo $?
148
 
                