It's almost certainly the case that your system is implemented in such a way that locals and automatic variables are allocated on the stack, and this in a system, such as the x86, where the stack grows downward. Presuming that 'a' is located at 1245412, in your case, then the variables are at the following addresses:
1245412 a 6
1245408 b 1024
1245404 swap 1245404 (&b - 1*sizeof int)
swap then becomes, after += 2*sizeof int, 1245404 + 8, 1245412, which is the address of a
when dereferenced, then, the value of a (6) is printed. Your number, 1245052, seems to be a typo.
Again, this is not only implementation dependent, hardware-wise, but also, software-wise. Exercises like this are only useful when produced on the same system with the same OS and the same compiler. Just a caveat.