title: How to convert a string to a complete integer number in C?
body: <p>I have tried in this way:</p>
  <pre><code>//Write a program to find out the reverse order of a given integer
  #include &lt;stdio.h&gt;
  int
  main(void){
  
  //Put variables for the further proceed
  int number, quotient=1, remainder;
  
  //Declare a character array
  char text[]=&quot;princeX&quot;;
  
  //Show the message to the user
  printf(&quot;Enter an integer number :&quot;);
  
  //Taking input from the user
  scanf(&quot;%d&quot;,&amp;number);
  
  //To find out the integer number in the reverse order
    while(quotient!=0){
    quotient=number/10;
    remainder=number%10;
    number=quotient;
    text[6] = remainder + '0';
    puts(text);
    }
  //Converts the string to a whole integer
  int numberUpdate=atoi(text);
  printf(&quot;%d&quot;,numberUpdate);
  
  
  }
  </code></pre>
  <p>I want to achieve: The user will give an integer number then my system will give the reverse order of the given integer number. To accomplish this goal I stored an integer into a character array but not entirely.</p>
  <p>For the input: <code>123456</code></p>
  <p>Output shows like from my code:</p>
  <pre><code>prince6
  prince5
  prince4
  prince3
  prince2
  prince1
  </code></pre>
  <p>Bu my expectation was:</p>
  <pre><code> 6
   5
   4
   3
   2
   1
  </code></pre>
  <p>After that, I just simply wanted to print those as an integer. But I could not do that. When I am going to transform these characters into an integer but the output shows zero. Which problem I have been made in my program and how can I solve that puzzle?</p>