You are here

Getarcoords function in C

Declaration: void getarccoords(struct arccoordstype *var);

getarccoords function is used to get coordinates of arc which is drawn most recently. arccoordstype is a predefined structure which is defined as follows:

struct arccoordstype
   int x, y;                /*   center point of arc    */
   int xstart, ystart;      /*   start position         */
   int xend, yend;          /*   end position           */

address of a structure variable of type arccoordstype is passed to function getarccoords.

C program of getarccoords


   int gd = DETECT, gm;
   struct arccoordstype a;
   char arr[100];

   initgraph(&gd, &gm,"C:\\TC\\BGI");


   sprintf(arr,"(%d, %d)",a.xstart,a.ystart);

   sprintf(arr,"(%d, %d)",a.xend,a.yend);

   return 0;

In the program, we have drawn an arc, and then we get the coordinates of its endpoints using getarccoords. Coordinates so obtained are displayed using outtextxy.