title: Returning a string in C without pointers?
body: <pre><code>#include &lt;stdio.h&gt;
  
  void read_string(char prompt[], char returned[], int MAX)
  {
  fputs(prompt, stdout);
  fflush(stdin);
  fgets(returned, MAX, stdin);
  }
  
  main()
  {
      char string[0][10];
  
  read_string("String you want to return ", string[0], sizeof string[0]); 
  
  printf("The returned string is %s",string[0]);
  
  fflush(stdin);
  getchar();
  
  }
  </code></pre>
  
  <p>This code is from an exercise I made (modified),just indicating the line of code I can´t understand very well. Its suppose to return various strings within a loop, hence I just declared the STRING [0][100], since its just an example.</p>
  
  <p>Well I understand that the variable "string" gets in the function like this
  string = returned
  Then after getting the string from the keyboard (fgets) how does it return to the main(), I mean does it really go back and implicitly do this?
  returned = string</p>
  
  <p>Also the compiler gives me this message when compiling (although it does really return me a string when running)</p>
  
  <p>[Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings]</p>
  
  <p>I´m new in learning functions and their structure, I haven´t seen pointers yet,but from what I´ve read so far you need pointers to return strings. Excuse any terrible mistakes and its poorly written code I´m very grateful with any guidance on solving this issue.</p>
  
  <p>The question in here mainly is about how does the string return, without needing to use <strong><em>return</em></strong>, I mean the string gets saved in the variable called "returned" but how does it get out of it, and get back in main.</p>