title: Shift Cipher in C
body: <p>I am making a program that adds a specific number to the ASCII value of every character in a string. The code gives me a "segmentation fault (core dumped)" error when running. What am i Doing wrong? I am new to C.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  main()
  {
      int a,b,c;
      char x[1000],y[1000];
  
      printf("String:");
      gets(x);
  
      printf("\nShift:");
      scanf("%d",a);
  
      b=0;
      printf("\n");
  
      while (b &lt; strlen(x))
      {
          c=x[b] + a;
          printf("%c",c);
          b++;
      }
  }
  </code></pre>