Structures Definition
Learn about structures to write better, more organized code.
Introduction
Let’s say we want a program to perform some mathematical data manipulation on two-dimensional points. We may be interested in calculating values such as:
- The distance between 2 points.
- The midpoint of a segment, given 2 points.
- The equation of a line, given 2 points.
- The slope of a line.
To provide a concrete example, let’s write code to calculate the distance between 2 points. The distance between points and is .
Get hands-on with 1400+ tech skills courses.