# Thread: Need a bit of help with pointers

1. ## Need a bit of help with pointers

Code:
```int main()
{
int form;
int x1,x2,y1,y2;
double m,b;

if(get_problem(form)==1)   //if get_problem return value is 1
{
get2_pt(&x1,&x2,&y1,&y2); //call the next function
display2_pt(&x1,&x2,&y1,&y2);
}
return 0;
}

int get_problem(int form)
{
printf("Select the form that you like to convert to slope-intercept form:\n1    ) Two-point form (you know two points on the line)\n2) Point-slope form (you     know the line's slope and one point)\n=> ");
scanf("%d",&form);
return form;  //user either enters 1 or 2
}

void get2_pt(int *x1,int *x2, int *y1,int *y2) //potential problem source
{
printf("Enter the x-y coordinates of the first point seperated by a space=>      ");
scanf("%d %d",&x1,&y1);
printf("Enter the x-y coordinates of the second point seperated by a space=>      ");

void display2_pt(int *x1, int *x2, int *y1, int *y2)
{
printf("Two-point form\n");
printf("%d%d",x2,x1); //instead of printing out the value, it prints out the address.
}```
My question is. Where did i go wrong? Print only prints only the addresses of the variable, and not the value

2. Well, if you want to print the value, print *x2 and *x1.

3. Hmm printf("%d%d",*x2,*x1);

still prints out the addresses. This is the deref operator, correct?

4. Originally Posted by tmac619619
Hmm printf("%d%d",*x2,*x1);

No, it doesn't.

Originally Posted by tmac619619
This is the deref operator, correct?
Yes.

Take a look at this line in the get2_pt function:
Code:
`scanf("%d %d",&x1,&y1);`
x1 and y1 are pointers, so why do you take their address when you want to read into an int? You should have written:
Code:
`scanf("%d %d", x1, y1);`

5. Thank you based god!