*(ptr + i) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

*(ptr + i)

int a[5] = {22, 33, 44, 55, 66}; int *ptr = NULL; int i; ptr = a; for (i = 0; i < 5; i++) { printf("%d ", *(ptr + i)); // why it writes like *(ptr + i) while i is an integer?

22nd Apr 2020, 11:27 AM
Zhengrong Yan
Zhengrong Yan - avatar
1 Answer
+ 6
This might help as an intro to pointer arithmetic 👇 https://codeforwin.org/2017/10/c-pointer-arithmetic.html
22nd Apr 2020, 11:45 AM
Ipang