In the diagram, $ABC$ is a straight line.  What is the value of $x$?

[asy]
draw((-10,0)--(10,0));
draw((0,0)--(7.66,6.43));
label("$A$",(-10,0),W);
label("$B$",(0,0),S);
label("$C$",(10,0),E);
label("$x^\circ$",(0,0),NW);
label("$40^\circ$",(1.5,0),NE);
[/asy]
Since the angles along a straight line add to $180^\circ$, then $x^\circ+40^\circ=180^\circ$ or $x+40=180$ or $x=\boxed{140}$.