Question: I am trying to print all inputted number by the user using the code below but instead of printing all inputted numbers it only print the last number I inputted.

```
#include<stdio.h>

int display(int n, int a, int b)
{
    printf("\n\nOrdered pairs are: ");
    for(int j=0;j<n;j++)
    {
        printf("(%d,%d) ",a,b);
    }
    return 0;
}
int main()
{
    int num,i,j,x,y;
    printf("Total number of points: ");
    scanf("%d",&num);
    for(i=0;i<num;i++)
    {
        printf("\n\nPoint #%d: \n",i+1);
        printf("x=");
        scanf("%d",&x);
        printf("y=");
        scanf("%d",&y);
        printf("Point #%d: (%d,%d)",i+1,x,y);
    }
    display(i,x,y);
    return 0;
}

```

Answer: 
You don't have memory for storing more than 2 numbers (`x` and `y`) which are over-written during each iteration of the loop.

Perhaps you meant to use arrays, or dynamically allocated memory. This:

```
int x[100], y[100];

```

is one way, then you can store up to 100 numbers in each of the two arrays. Use array indexing when accessing.
Actually you are changing the value stored in x and y again and again and so, the previous values get destroyed and only the last value is stored. So you can you arrays (which are more easier to use) or you can even use structure (I would prefer to use arrays).