printf function follows cedecl parameter passing convention. That is parameter will pass from right to left direction.
(*(int *)ptr)—-
= (*&val)—
= val—-
Here –- post decrement operator. So first it will assign its value i.e. printf function will print 1234 and value of variable val will decrement by one. So
val = 1233
Now second parameter will pass:
++val
So, val = 1234