-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPointer7_array4.c
More file actions
28 lines (19 loc) · 819 Bytes
/
Pointer7_array4.c
File metadata and controls
28 lines (19 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// author: jaydattpatel
#include<stdio.h>
int main()
{
int *p; // Pointer to an integer
int (*ptr)[5]; // Pointer to an 5 array of 5 integers
int arr[5]={11,22,33,44,55};
p = arr; // Points to 0th element of the arr.
ptr = &arr; // Points to the whole array arr.
printf("Val of p = %d, add of p = %x\n",*p+0, p+0);
printf("Val of p = %d, add of p = %x\n",*p+1, p+1);
printf("Val of p = %d, add of p = %x\n",*p+2, p+2);
printf("Val of p = %d, add of p = %x\n",*p+3, p+3);
printf("Val of ptr = %d, add of ptr = %x\n",*(ptr[0]+0), ptr[0]+0);
printf("Val of ptr = %d, add of ptr = %x\n",*(ptr[0]+1), ptr[0]+1);
printf("Val of ptr = %d, add of ptr = %x\n",*(ptr[0]+2), ptr[0]+2);
printf("Val of ptr = %d, add of ptr = %x\n",*(ptr[0]+3), ptr[0]+3);
return 0;
}