There is a difference between "in C" and "in the key of C major".
A jazz tune in C can be ambiguous between several modes (like, say, parallel major and minor, or parallel mixolydian, dorian and natural minor, or all of these), with the common denominator being the root note of C. This root note sets the "tonality" of the music.
Similarly, blues in C does not necessarily mean major or minor. The tune could make parallel use of the minor and major pentatonic scales as well as the tritone.
The "key of C major" is somewhat more restrictive than just the tonality. It suggests that the music is probably organized around traditional concepts of harmony rooted in the European classical tradition. (An empty key signature, by the way, does not imply the key of C major; it could be A minor, of course. If harmonic or melodic minor occurs, the F# and G# appear as incidentals.)
The key or tonality might apply to just the opening bars of the music. Music which modulates to another tonal centre is still usually identified by the starting tonality. Often, composers return the music to the original tonality, but not always.
For example, in Baroque music, the common two-part form often goes from I to V in the first part, and the second part returns from V to I. The overall piece is identified as just being in I major or minor. The excursions into other keys are not acknowledged in the basic identification. So such and such a composer's "sonata in such and such minor key" can easily go through all twelve major and minor keys. It's possible for a multi-part work to be identified in C major as a whole, but to have entire movements that are not in C major. An example of this is Vivaldi's "Concerto per Flautino" in C major. (RV 443). The opening and closing movements are major (at least in their beginning and ending). The slow middle movement is in A minor.
Furthermore, a piece identified as C major could stay in C, but make small "parenthetical" modulations, such as the use of applied (a.k.a. "secondary") dominants. This is a harmonic device whereby the composer pretends that a target note or chord which is within the key is actually the tonic note of its own key. The composer then writes a cadence which resolves to that note. The cadence could just be a V-I (where the I is not the surrounding key, but the target note), or something somewhat more extended like a II-V-I.
For example, you can definitely work an A7 chord into C major music. It can create tension which resolves to Dm. The chord progression C A7 Dm G7 can be used as the basis of a C major song.
The A7 is just bit of "color" that is outside of the scale, but not a full-blown modulation. Identifying your music as being in the key of C major does not preclude the use of some sharps and flats which are not key changes.