r is a character pointer. r[6] = 'M' and r[3] = 'G'.
In C language, alphabet letters must have consecutive integer values.So, r[6] - r[3] = number of letters between 'G' and 'M' = 6.
Now, r + 6 = value in r + 6 * (sizeof(char))
= r + 6.
When %s is used in printf, all characters are printed from the passed address till "\0". So, when r+6 is passed, all characters from the location r+6 are printed till "\0". So,we get M1234 as output.
PS: In C language "\0" is automatically added at end to all string literals like "PROGRAM1234".