#include<stdio.h>
int main()
{
int a[2] = {1, 2};
void *ptr = &a; //here &a provides the base address of array and it is assigned to ptr and *ptr points to a[1]
ptr = ptr + sizeof(int); // here ptr is incremented by size of int i.e., it is moved one location ahead now *ptr points to a[2]
printf("%d", *(int *)ptr); // here ptr is type casted a integer pointer and value of *ptr is printed i.e., it prints the valus in a[2]
return 0;
}
Output:
2