refernces and pointers

hey guys i wanted to knw if one can create a reference to a reference and a pointer to a reference n cud one show me how to rite it in code....my theory is down below..tanx in advance

1
2
  int &&t;  
int *&s;

plus is the time taken to access the last element im a vector propotional to the toral number of elements in a vector..tanx again
Last edited on
You can't have references or pointers to references.

int&& is a rvalue-reference.
int*& is a reference to a pointer.
Elaborating on Peter87's answer, a reference is an alias for another variable. It is often implemented using a pointer, but that's an implementation detail. The concept of a reference is so you can give a new name to an existing variable. If you think of it this way, then it's obvious that
1. A reference to a reference just creates a 3rd name for the same variable:
1
2
3
int a;
int &b=a;
int &c = b; // a, b, and c now all refer to the same variable. 


2. A pointer to a reference is just a pointer to the variable to that it refers to.
tanx guys..wat abt de last question of accesing last element in a vector
Propotional to the total number of elements in a vector means it takes more time to access the last element in a vector if the vector is larger. Do you think this is the case? Why?
well i can use v.back to access last element witout iterating thru de vector
Topic archived. No new replies allowed.