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).
Compiles to the exactly same thing.

@Shervan80, Consider making https://gcc.godbolt.org/ part of your workflow.
Topic archived. No new replies allowed.