You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
547 B
C
24 lines
547 B
C
#include <stdio.h>
|
|
#define ASIZE (10)
|
|
|
|
int main()
|
|
{
|
|
size_t i = 0;
|
|
int *p = NULL;
|
|
int my_array[ASIZE];
|
|
|
|
/* Setting up the the values of the array to i * i*/
|
|
for (i = 0; i < ASIZE; i++)
|
|
{
|
|
// square the arrary index
|
|
my_array[i] = i * i; // Interesting enough th size_t is unsigned long which will be converted to int
|
|
}
|
|
|
|
/* Reading the values using a pointer */
|
|
for (p = my_array; p < my_array + ASIZE; ++p)
|
|
{
|
|
printf("%d\n", *p); // dereference the memory location
|
|
}
|
|
|
|
return 0;
|
|
} |