You are here

Arc function in C

Declaration: void arc(int x, int y, int stangle, int endangle, int radius);

"arc" function is used to draw an arc with center (x, y) and stangle specifies starting angle, endangle specifies the end angle and last parameter specifies the radius of the arc. arc function can also be used to draw a circle but for that starting angle and end angle should be 0 and 360 respectively.

C programming source code for arc

  1. #include <graphics.h>
  2. #include <conio.h>
  3.  
  4. int main()
  5. {
  6.    int gd = DETECT, gm;
  7.  
  8.    initgraph(&gd, &gm, "C:\\TC\\BGI");
  9.  
  10.    arc(100, 100, 0, 135, 50);
  11.    
  12.    getch();
  13.    closegraph();
  14.    return 0;
  15. }

In the program (100, 100) are coordinates of center of arc, 0 is the starting angle, 135 is the end angle and radius of the arc is 50.