title: c program using pointers of reverse
body: <p>Why it's not functioning? compiler says its returning local address. any help how to make it it correct. i saw other reverse string programs but i didn't find any problem in it.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  
  char *reverse(char *str);
  
  void main()
  {
      char str[]="jamesbond";
      int len=strlen(str);
      char *ptr;
      ptr=reverse(str);
      printf("the reversed string is :%s",ptr);
  }
  
  char *reverse(char *str)
  { 
      int i,j;
      int len=strlen(str);
      char qtr[len];
  
      for( i=len-1;i&lt;=0;i--)
      { 
          for( j=0;j&lt;len-1;j++)
              qtr[j]=*(str+i);
      }
      return qtr;
  }
  </code></pre>