Add x and y coordinates to create a new struct in C Program

How to Add x and y coordinates to create a new struct in C Programming Language ?


/*Supply two cartesian_t structs and add x and y coordinates to create a new struct*/

  1. struct cartesian_t add(struct cartesian_t a, struct cartesian_t b){
  2.         struct cartesian_t coordsSum;
  3.         coordsSum.x = (a.x) + (b.x);
  4.         coordsSum.y = (a.y) + (b.y);
  5.         return coordsSum;
  6. }


Learn More :