title: How to put character from variable into array in C?
body: <p>I want to put a character from a variable into a character array in C. Also I want to print the reversed array afterwards as you can see but that's not the issue now.</p>
  
  <p>This is the code I've got so far:</p>
  
  <p>As stdin I'm using a txt-file with "&lt; input.txt" as a command line argument, and it has 57 characters.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
    int counter = 0;
    char character_array[57];
    int i = 0;
    int j = 0;
    char character = 0;
  
    // While EOF is not encountered read each character
    while (counter != EOF) 
    {
      // Print each character
      printf("%c", counter);
      // Continue getting characters from the stdin/input file
      counter = getchar(stdin);
      // Put each character into an array
      character_array[j] = { counter };
      j = j + 1;
    }
  
    // Print the array elements in reverse order
    for (i = 58; i &gt; 0; i--)
    {
      character = character_array[i];
      printf("%c", character);
    }
  
    return 0;
  }
  </code></pre>
  
  <p>My IDE says at line 35 after the first curly brace "expected expression".</p>
  
  <pre><code>// Put each character into an array
      character_array[j] = { counter };
  </code></pre>
  
  <p>So I guess it fails there. I assume I cannot just put the character variable like that in the array? How would I go about doing this otherwise?</p>
  
  <p>PS: I'm new to C.</p>