C Program to Draw Line in Graphics Mode : Line Function

Live Program : Drawing Line in Graphics Mode Using Graphics Function

Explanation of Code :

We have declared above variables so that we can keep track of starting and ending point.

We need to pass just 4 parameters to the line() function.

  • Line Function Draws Line From (x1,y1) to (x2,y2) .

Syntax :

Parameter Explanation
x1 X Co-ordinate of First Point
y1 Y Co-ordinate of First Point
x2 X Co-ordinate of Second Point
y2 Y Co-ordinate of Second Point