Accessing array elements using pointers or subscripts?
Hello,
Which is faster?
Accessing array elements using pointers or subscripts?
Thanks
1 2 3 4 5
|
int num[] = { 24,34,12,44,56,17 };
printf_s("%d",*(num+2)); // Which is faster?
printf_s("%d", num[2]);
| |
Compiles to the exactly same thing. Do what easier to read (the second one, most likely).
Topic archived. No new replies allowed.