Graphical Explainnation : '''

    #include <stdio.h>
    int main()
    {
       int c;  /* Present Charecter */
       int old_c; /* Previous Charecter */
    
       while((c = getchar()) != EOF) {
          if(old_c == ' ' && c != ' '){
             putchar(' ');
             putchar(c);
          }else if(c != ' '){
             putchar(c);
          }
          old_c = c;
       }
       return 0;
    }

'''
I don't really understand how this code works. This is a solution for the C The programming language exercise 1.9;

So here is my Problem

For example i type in as Input : Hello  World\n
is the '\n' not the last character ? save into old_c : old_c = c;

could someone please explain to me how to code works as i really want to learn the c programming language and programming. 
i am a very beginner;