When talking about a set of chords in a key, we label each chord with a roman numeral (I to VII). There are seven chords in all, one built on each note of the scale:
These are the scales and modes you can use if you come across a C Major chord in any of the above keys.
For example, if C was the root (I) chord and we wanted to solo over this chord, we would use the C Ionian mode (which is identical to the major scale), or the C major pentatonic Scale.
If we wanted to solo over a C (IV) chord when playing in the key of G major, we would use the Lydian mode (starting on C).
If we wanted to solo over a C (V) chord when playing in the key of F major, we would use the Mixolydian mode (starting on C).
These are the scales you can use if you come across an A minor chord in any of the above keys.
For example, if A minor was the root (I chord), you could use A harmonic minor, A melodic minor, or A minor pentatonic as melody tools.
If you wanted to solo over an A minor chord and you were in the key of F major, you would use the Phrygian mode (starting on A).
If you were in the key of G major, you would use the Dorian mode (starting on A).
If you were in the key of C major, you would use the Aeolian mode (starting on A), which is identical to the A natural minor Scale.
These rules can be applied to all keys.