-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 ?

3
  • 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 for more :) Commented Jan 13, 2016 at 20:54
  • How about stackoverflow.com/q/6814533/1741542? Commented Jan 13, 2016 at 20:56
  • Firstly you should read something about pointers, then you should study pointer arithmetic, that's what you are looking for Commented Jan 13, 2016 at 23:59

1 Answer 1

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)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.