• Here is Microsoft's take on it. Be sure to scroll down and read and think about the examples.
  • * is used to declare a pointer which point the memory location of variable suppose if you declare int *mypointer and other you have int x; and you write in next line mypointer=&x; it would get the memory adress useing pointer and then using & it would not print the memory adress it would print the value stored in x labeled memory space if you dont use & then it would show the memory name like 0xff84 etc
  • Example use: int *x ,a; a = 5; x= a; //x now contains the adress of a ,*x is equal to a (5) ++++++++++++++++++++++++++++++++++++++++++ int a=1; int &x =a; //Now x is a reference to a //Whenever you change a ,x is changed //X is like atwin of a.

Copyright 2023, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy