C-rating and MAh work together. 40C and 1200mHa means that the battery can supply 40 x 1200 = 48000mA = 48A. As a general rule I aim to have something like double the amps I need for long battery life and good flight duration, so that battery would be OK for a motor that draws a maximum 24 amps.
So, you work back from your motor and prop to see how many amps it's likely to pull, then you can choose a C-rating and mHa to suit. say your motor draws 20A, then you could use a 40C 1000mAh or 80C 500mAh. or any similar combination.
The mAh is the amount of charge in the battery, which is basically the length of your flight possible. The more mHa, the longer you can fly. With a 20A max motor drawing an average 10 amps in flight, a 1000mAh battery will last 1/10 hours = 6 minutes. A 500mAh one will last 3 minutes.
Finally, the more mAh you have, the bigger and heavier the battery is. A big battery in a small plane or a small battery in a big plane might not have the weight to get the C og G correct.
In summary, you have to juggle 3 things: The right weight for your plane; enough current for your motor; and enough capacity to get a long enough flight.
It's not an exact science. These are only guidelines for what you need, though the maths is exact. You have to think about proportion of the time you'll be flying with full throttle and maximum current. if you have loads of money, you can always buy the highest C-rating when you buy batteries because they'll work in the highest range of applications. If money is tight, so you have to buy 20C batteries, you have to be more careful with your calculations to make sure that it can give enough current.