-4

I want to display the contents of an array with type double that has a length of 5 without using the [ ] indexing . I can only use a for loop and pointer techniques.

How can you achieve that ? Can anyone give me a brief explanation of pointers as I have no idea how to use them exactly ?

dbush
  • 205,898
  • 23
  • 218
  • 273
Takari
  • 29
  • 2
  • 3
  • 8
  • 4
    Have you tried anything or even did a google research? There is a ton of documentation about pointers out there. If you want a detailled answer, please ask a detailed question. See [how to ask a question](http://stackoverflow.com/help/how-to-ask) for more :) – Magix Jan 13 '16 at 20:54
  • How about http://stackoverflow.com/q/6814533/1741542? – Olaf Dietsche Jan 13 '16 at 20:56
  • Firstly you should read something about pointers, then you should study pointer arithmetic, that's what you are looking for – Claudio Cortese Jan 13 '16 at 23:59

1 Answers1

2

The array indexing operator is a shorthand for hiding pointer arithmetic.

So if you have an array like this:

double a[5];

Instead of using this expression:

a[1]

You can use this:

*(a + 1)
dbush
  • 205,898
  • 23
  • 218
  • 273