forked from MadhavBahl/OOPS
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPointToArray.c
More file actions
16 lines (16 loc) · 890 Bytes
/
PointToArray.c
File metadata and controls
16 lines (16 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<stdio.h>
int main() {
int gradeList[8] = {92,85,75,88,79,54,34,96};
int *myGrades = gradeList;
printf("1st element of gradelist using array index: %d\n",gradeList[0]);
printf("1st element of gradelist using pointer: %d\n",*myGrades);
printf("2nd element of gradelist using array index: %d\n", *(myGrades + 1));
printf("2nd element of gradelist using pointer: %d\n", myGrades[1]);
printf("3rd element of gradelist using array index: %d\n", *(myGrades + 2));
printf("3rd element of gradelist using pointer: %d\n", myGrades[2]);
printf("4th element of gradelist using array index: %d\n", *(myGrades + 3));
printf("4th element of gradelist using pointer %d\n", myGrades[3]);
printf("5th element of gradelist using array index: %d\n", *(myGrades + 4));
printf("5th element of gradelist using pointer: %d\n", myGrades[4]);
return 0;
}