dynamic memory question

Hi guys I have a short question,I'm just wondering how come when you set a pointer to = data in dynamic memory how come you don't use &?

for example

1
2
3
4
5
6
  int a = 6;
  int *b = &a; // LEGAL

  int *b  = a; // NOT LEGAL

   



well how come you don't need to put the & when using the keyword new?


for example


1
2
3
4
5
  int *a;
  a = new int[2];  // LEGAL
  
  a = new &int[2] // NOT LEGAL


thanks
new int[2] returns a pointer to the first int in the newly created array.
but how come you don't declare it with the address of operator?
Why would you?
Topic archived. No new replies allowed.