title: Simple caesar cipher in C with no user input
body: <p>I need to write a program that stores a specific message (S M Z V Q O P I V) in a set of char variables, and then applies a shift value of 8 before outputting the decrypted message one character at a time. The output should look like a string of characters by using a format string that includes multiple %c specifiers. </p>
  
  <p>I can only find examples of code that require input from the user, and although I just modified this to have variables that already hold the required values, I am struggling to make sense of how the code is supposed to iterate through the string - i.e. ch = ch - 'Z' + 'A' = 1, what does this actually mean in terms of using operators between letters?  </p>
  
  <p>This is what I have so far, although the code outputs [Ub^YWXQ^ as the encrypted message - is there any way to correct the characters that should be letters? Should Z become H?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
      char message[] = "SMZVQOPIV";
      int i;
      int key = 8;
  
      printf("%s", message);
  
      char ch= message [i];
  
      for(i = 0; message[i] !='\0';++i)
      {
          ch = message[i];
  
          if(ch &gt;= 'A' &amp;&amp; ch &lt;= 'Z'){
              ch = ch + key;
              if (ch &gt; 'z'){
                  ch = ch - 'Z' + 'A' - 1;
              }
              message[i] = ch;
          }
      }
  
      printf("Encrypted Message: %s", message);
      return 0;
  }
  </code></pre>
  
  <p>Could anybody briefly talk me through how the code should look and why please? It's been a while since I did any programming and I mostly used to use Python, so am a bit lost in C.</p>