I am trying to do this in c:
scanf("%d",a+i);
where a
is an array of size 10
. And i
is counter for loop. So is this possible?
Absolutely: if a
is an int*
or an array int a[10]
, and i
is between 0 and 9, this expression is valid.
The a+i
expression is the pointer arithmetic equivalent of &a[i]
, which is also a valid expression to pass to scanf
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With