#include #include // required for malloc int main() { double *a; int i, n; double b[7]; printf("Enter the size of array: "); scanf("%d", &n); a = (double *)malloc(n * sizeof(double)); // sizeof(double) is required as it is in bytes printf("Size of a is %d\n", sizeof(a)); // size of the pointer printf("Size of b is %d\n", sizeof(b)); // size of array is the total space allotted in bytes printf("Number of elements in b is %d\n", sizeof(b) / sizeof(double)); for (i = 0; i < n; i++) a[i] = i; // array notation for (i = 0; i < n; i++) printf("%lf %lf\t", a[i], *(a + i)); printf("\n"); printf("&a is %u, while a[0] is at %u\n", &a, &a[0]); // a is a separate variable stored elsewhere printf("&b is %u, while b[0] is at %u\n", &b, &b[0]); // b is not stored separately free(a); // important as otherwise space is not freed }