Search⌘ K
AI Features

Discussion: Superhero’s Secret Identity

Learn to distinguish between array and pointer notation in C programming. Understand how pointers hold memory addresses and how to safely convert array indexing to pointer arithmetic. This lesson helps you grasp key memory concepts and avoid common errors in pointer usage.

Run the code

Now, it's time to execute the code and observe the output.

C
#include <stdio.h>
#define SIZE 5
int main()
{
int values[SIZE] = {2, 3, 5, 8, 13};
int *v, x;
/* initialize the pointer */
v = values;
for( x=0; x<SIZE; x++ ) {
printf("%2d = %2d\n",
values[x],
*(v+x)
);
}
return(0);
}

Understanding the output

The code ...