When a song consists of notes from a particular scale, it is said to be written in the key which has the same notes as that scale. For example, if a song contains mostly notes from the C major scale, it is said to be in the key of C major. The following song is in the key of C major.
Here are the notes from the diagram written in standard music notation and tablature. Because the lowest note in the fingering is G instead of C, a different effect is produced. This can be used deliberately to create a variety of sounds from the scale when soloing.
It is not necessary to always start and finish on the note C. Depending on which chords you are playing over, it may sound best to start on any of the notes in the scale. E.g., if you were playing over a C chord followed by a D minor chord you could play the scale starting on C for the C chord but start on D for the D minor chord, as shown in the following example.