Jump to content


Photo

[solved] -C++ Help


  • This topic is locked This topic is locked
4 replies to this topic

#1 TheUnforgiven512

TheUnforgiven512

    Young Padawan

  • Members
  • Pip
  • 102 posts

Posted 22 December 2005 - 05:12 PM

What does & do? I was reading something and they made a variable called num. Then in a different function they had it &num. does it point to it or what?

#2 Ckristian

Ckristian

    Honored X Staff

  • Members
  • PipPipPipPip
  • 1,334 posts
  • Gender:Male
  • Location:A blue-green "planet" Mostly harmless
  • Interests:Programming...

Posted 23 December 2005 - 12:07 AM

&num will give you the memory location where the variable num is stored.
cout<<&num;
This will print the address.

Edited by Ckristian, 23 December 2005 - 12:09 AM.


#3 PSgirl

PSgirl

    P2L Staff

  • P2L Staff
  • PipPipPipPip
  • 2,056 posts
  • Gender:Female

Posted 23 December 2005 - 04:28 AM

In functions, the example you give is called Reference parameter.
Here you can read all the explanation.

#4 TheUnforgiven512

TheUnforgiven512

    Young Padawan

  • Members
  • Pip
  • 102 posts

Posted 23 December 2005 - 04:25 PM

Okay thanks for the info. I understand it now

#5 Jaymz

Jaymz

    Retired P2L Staff

  • Members
  • PipPipPipPip
  • 4,104 posts

Posted 23 December 2005 - 04:27 PM

Original question has been answered we are re-solving this thread, if you have any further questions please start a new topic.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users