Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8036019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:28:48+00:00 2026-06-05T02:28:48+00:00

typedef struct { double a; // coefficient for x double b; // coefficient for

  • 0
typedef struct {
   double a; // coefficient for x
   double b; // coefficient for y
   double c; // constant term
} line;

points_to_line(point p1, point p2, line *l)
{
   if (p1[X] == p2[X]) {
      l->a = 1;
      l->b = 0;
      l->c = -p1[X];
} else {
      l->b = 1;
      l->a = -(p1[Y]-p2[Y])/(p1[X]-p2[X]);
      l->c = -(l->a * p1[X]) - (l->b * p1[Y]);
}

I’m reading Programming Challenges book by (Steven S. Skiena and Miguel Revilla), maybe someone should have been read this book.

p1[X] is point p1’s X value, and [Y] is Y value.

This function makes a linear equation line. (line *l)
First If sentense makes x + C (p1[X]) = 0 to l.

What I don’t know is:

  • In C language, how can I represent p1[X]??

  • Is p1 a one dimentional array? then, X and Y is constant macro??

  • Or, using C++, Is this a overloaded operator[] ?? then, point type has overloaded operator[]???

  • Or is there point type in C?? I searched google “point type C” and, I found nothing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:28:50+00:00Added an answer on June 5, 2026 at 2:28 am

    Assuming it is C code, as p1 is accessed with [] operator, my guess is point type is likely to be a typedef to an array.

    #define X  0
    #define Y  1
    typedef double point[2];
    

    I think it is double because (p1[Y]-p2[Y])/(p1[X]-p2[X]) expression is written without double casts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my struct typedef struct { char mmsi[10]; char name[20]; double latitude; double
I have the following structure typedef struct _LSHFunctionT { double *a; double b; }
I've defined the following struct: typedef struct { double salary; } Employee; I want
I had come across the following code: typedef struct { double x; double y;
typedef struct Complex{ double real; int img; } Complex; I've seen people use it
I have a short piece of code like this: typedef struct { double sX;
typedef struct Matrix { double * matrix; int sizex; int sizey; }Matrix; int nn
I have Struct like these typedef struct sample { double x, double y, double
I have something like this in my code typedef struct ts_fem_mesh { double **vertices;
In my data.h file I have: typedef struct { double ***grid; } Solver; In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.