Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Arc function in C
In the C programming language, there is an option to create an arc of a circle of a given radius with a given center coordinates and degree of the arc.
The arc() function is used to create an arc. This arc function is included in graphics.h library in C which contains methods that can draw figures on the output screen.
Syntax
void arc(int x, int y, int startangle, int endangle, int radius);
Now, let's get deep into the function and understand each parameter passed and output returned by the function.
Parameters
x − type = int, function: defines the x coordinate of the center of the arc.
y − type = int, function: defines the y coordinate of the center of the arc.
start angle − type = int, function: defines the starting angle of arc.
entangle − type = int, function: defines the ending angle of arc.
Radius − type = int, function: defines the radius of the arc.
Example
#include <graphics.h>
int main(){
int gd = DETECT, gm;
int x = 250;
int y = 250;
int start_angle = 155;
int end_angle = 300;
int radius = 100;
initgraph(&gd, &gm, "");
arc(x, y, start_angle, end_angle, radius);
getch();
closegraph();
return 0;
} 