title: Why am I getting "array initializer must be an initializer list or string literal"?
body: <p>I am completely new to C programming and the language I used to work on before C was Java. I am trying to get a method to return a char array and it is not working. Here is my syntax:</p>
  
  <pre><code>char * insertToArray(char * val){
      int k;
      char arr[2] = val;
      // do some other staffs here to the value
      return arr;
  }
  
  int main(){
      char s1[] = {"one", "two"};
      char newArr[];
      int i;
  
      for(i = 0; i &lt; 2; i++){
          newArr[] = insertToArray(s1[i]);
      } 
  
      return 0;
  }
  </code></pre>
  
  <p>All I am trying to do is pass the <code>s1</code> array to <code>insertToArray</code> and do some kind of calculation on the values, then return a whole new single array. I am a complete beginner and I couldn't find any other help online. What am I doing wrong?</p>