The following code shows how to Create and Display Elements of an Array using Pointers in C. Also, the address of the elements also printed along with the element value.

// Read and display elements of an array using pointers

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
    int i, total, number;
    printf("How many elements do you want in the array?");
    scanf("%d", &total);
    double *arr=malloc(total*sizeof(int));
        printf("%lf  %p\n", *(arr+i), (arr+i));

    return 0;


How many elements do you want in the array?10
3.162278 0x55736359cac0
4.472136 0x55736359cac8
5.477226 0x55736359cad0
6.324555 0x55736359cad8
7.071068 0x55736359cae0
7.745967 0x55736359cae8
8.366600 0x55736359caf0
8.944272 0x55736359caf8
9.486833 0x55736359cb00
10.000000 0x55736359cb08

Further Reading

50+ C Programming Interview Questions and Answers

C Program to Find Factorial of a Number