w is the current width of the image. During the process of seamcarving the actual width (i.e. the column from which on there will be only black pixels), changes and the the function
carve_path needs to know, what the current width is.
The function also needs to know the original width, but there is a reason why it is not given as an explicit argument.