title: C graphics: How to draw x-y axis on screen?
body: <p>I found this code for the same.But i am not getting what is being done.Can someone explain me the code?
  Here xmid=getmaxx()/2  and ymid=getmaxy()/2 .
  I want to know why we are using these for loops? Why itoa() function is used?</p>
  
  <pre><code>line(5,ymid,getmaxx()-5,ymid);
  line(xmid+3,5,xmid+3,getmaxy()-5);
  
  for( i= xmid+gap;i&lt;getmaxx()-5;i=i+gap)
  {
  outtextxy(i,ymid-3,"|");
  itoa(i-xmid,str,10);
  outtextxy(i,ymid+3,str);
  }
  for( i= ymid-gap;i&gt;5;i=i-gap)
  {
  outtextxy(xmid,i,"-");
  itoa(ymid-i,str,10);
  outtextxy(xmid+5,i,str);
  
  }
  for( i= xmid-gap;i&gt;5;i=i-gap)
  {
  
  outtextxy(i,ymid-3,"|");
  itoa(-(xmid-i),str,10);
  outtextxy(i-6,ymid+3,str);
  
  }
  for( i= ymid+gap;i&lt;getmaxy()-5;i=i+gap)
  {
  outtextxy(xmid,i,"-");
  itoa(-(i-ymid),str,10);
  outtextxy(xmid+8,i,str);
  }
  </code></pre>