Many melodies use notes from outside the major scale, particularly in styles such as Jazz, Blues, and modern Classical music. These "outside notes" are called accidentals. They relate to the chromatic scale which starts on the same note as the major scale of the key in which the music is written. Therefore, if you have a piece of music in the key of C, which contains notes which are not in the C major scale, you can relate these notes to the C chromatic scale.
Accidentals are indicated by the use of sharp, flat or natural signs. Accidentals are notes not contained in the key signature of a piece.