You are here:

C++/array vs reference

Advertisement


Question
what is array name.
a pointer or reference?

Answer
Hi,
  int arr[10];
  int *p=arr;

Here "arr" is the address of the start of the array which is of lenght 100.
p is a variable which contains the value which is the address of start.
Reference "int &ref = arr[0];"
 is an alias of arr[0] here.

Thanks,
RaiD

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Dharmender Rai

Expertise

I can answer general and system level C/C++ questions.

Experience

I have 5 years of experience in C++.

©2016 About.com. All rights reserved.