Rach3 is right.
Mozart composed his Sonata in C minor (k 457) in 1784 – 1785 (published in 1785). He then decided to write a fantasy in the same key to come before the sonata. The sonata was finished first – about six months before the Fantasy (k 475).
Are they meant to be played together? There is a lot of debate about this. Mozart certainly thought so, but each piece stands well on its own. Brendel for instance is so determined that they should not be played together that during his 1991 Mozart recitals he inserted the B minor Adagio (K 540) in between them. Other pianists think that both pieces have more impact if played together. So, choose your side.
Best wishes,
Bernhard.