Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

arrays / pointers (C)

Tags:

arrays

c

pointers

in C is: *(array) equivalent to array[0]?

Therefore is *(array+2) equivalent to array[2]?

like image 950
Lyndon White Avatar asked Dec 31 '25 18:12

Lyndon White


1 Answers

Yes, for instance:

given:

int a[10];

Then

*(a + 2)

is equivalent to

a[2]

and just for good measure.

a[2]

is equivalent to

2[a]
like image 109
BobbyShaftoe Avatar answered Jan 03 '26 07:01

BobbyShaftoe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!