Warning: Illegal string offset 'html' in /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php on line 909

Warning: Cannot modify header information - headers already sent by (output started at /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php:909) in /home/hsn/public_html/forum/admin/sources/classes/output/formats/html/htmlOutput.php on line 114

Warning: Cannot modify header information - headers already sent by (output started at /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php:909) in /home/hsn/public_html/forum/admin/sources/classes/output/formats/html/htmlOutput.php on line 127

Warning: Cannot modify header information - headers already sent by (output started at /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php:909) in /home/hsn/public_html/forum/admin/sources/classes/output/formats/html/htmlOutput.php on line 136

Warning: Cannot modify header information - headers already sent by (output started at /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php:909) in /home/hsn/public_html/forum/admin/sources/classes/output/formats/html/htmlOutput.php on line 137

Warning: Cannot modify header information - headers already sent by (output started at /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php:909) in /home/hsn/public_html/forum/admin/sources/classes/output/formats/html/htmlOutput.php on line 141
parameter passing - HSN forum

Jump to content


parameter passing


7 replies to this topic

#1 dontcrytonight

    Showing Improvement

  • Members
  • PipPip
  • 13 posts
  • Gender:Female

Posted 27 May 2006 - 10:56 AM

heyy really confused with all the perameter passing things lol
Can some one give me a good definition of passing by value and passing by reference please (to memorise lol)... cos different books have different terms and im jus confused now.. sad.gif

also anything you think may come up in the exam that i can memorise is helpful tongue.gif

cheersss

xxx

#2 John

    HSN Legend

  • Members
  • PipPipPipPipPipPipPipPip
  • 2,713 posts
  • Location:In a Peripheral Estate in Glasgow
  • Interests:First the boring stuff:<br /><br />2004 Results:<br /><br />Highers:<br /><br />Computing A<br />Craft and Design A<br />Physics A<br />Administration A<br />English A<br />Maths A<br />Modern Studies A<br />French A<br /><br />2005 Results:<br /><br />Advanced Highers:<br />Computing A<br />Physics A<br />Maths A<br />Modern Studies A<br />English A<br /><br />2006 Results:<br /><br />Advanced Highers(All Crashed):<br />Chemistry A<br />Biology A<br />Business Managemnt A<br /><br />Aren't I marvellous?
  • Gender:Male

Posted 27 May 2006 - 11:26 AM

Passing by value is when you pass a copy of the variable into the function.

You will use by value referencing when you do not want the variable to change.


By reference is when you pass the variable itself into the function.

You will use such referencing when you require the variable to change.

#3 Dave

    Ruler (but not owner) of hsn

  • Moderators
  • PipPipPipPipPipPipPipPip
  • 4,252 posts
  • Location:kilmarnock(ok kilmaurs)
  • Interests:programming, exercising, brass band, using this board
  • Gender:Male

Posted 27 May 2006 - 11:35 AM

its just a small point but what i think actually happens is that by reference is where the function recieves a pointer to where the variable is. The pointer is like a piece of data indicating the location of the variable

If i am not here i am somewhere else



#4 Pammy

    Site Swot

  • Members
  • PipPipPipPip
  • 194 posts
  • Location:Glasgow(ish)
  • Interests:Swimming, music (listening and playin), goin to the flicks, shopping &lt;3, shoes, glitter, reading, flowers, msn, bowling for soup, westlife, bags and nailpolish
  • Gender:Female

Posted 27 May 2006 - 11:48 AM

QUOTE(Sodium_Ho @ May 27 2006, 11:26 AM) View Post

Passing by value is when you pass a copy of the variable into the function.

You will use by value referencing when you do not want the variable to change.


By reference is when you pass the variable itself into the function.

You will use such referencing when you require the variable to change.


My teacher told us that it is not enough to say that passing by reference does not change a variable and passing by value does, so you will need to say that a copy is passed in for reference and the variable itself is passed in for value. So you need to include ALL of what Sodium Ho said. biggrin.gif
*~* Kiss me, beneath the milky twilight, lead me, out on the moonlit floor, lift your open hand, strike up the band and make the fireflies dance, silver moon sparkling, so kiss me *~*

#5 John

    HSN Legend

  • Members
  • PipPipPipPipPipPipPipPip
  • 2,713 posts
  • Location:In a Peripheral Estate in Glasgow
  • Interests:First the boring stuff:<br /><br />2004 Results:<br /><br />Highers:<br /><br />Computing A<br />Craft and Design A<br />Physics A<br />Administration A<br />English A<br />Maths A<br />Modern Studies A<br />French A<br /><br />2005 Results:<br /><br />Advanced Highers:<br />Computing A<br />Physics A<br />Maths A<br />Modern Studies A<br />English A<br /><br />2006 Results:<br /><br />Advanced Highers(All Crashed):<br />Chemistry A<br />Biology A<br />Business Managemnt A<br /><br />Aren't I marvellous?
  • Gender:Male

Posted 27 May 2006 - 12:41 PM

QUOTE(Dave @ May 27 2006, 12:35 PM) View Post

its just a small point but what i think actually happens is that by reference is where the function recieves a pointer to where the variable is. The pointer is like a piece of data indicating the location of the variable


Slightly beyond the higher Dave, but true, so is worth knowing that.

QUOTE(Pammy @ May 27 2006, 12:48 PM) View Post

QUOTE(Sodium_Ho @ May 27 2006, 11:26 AM) View Post

Passing by value is when you pass a copy of the variable into the function.

You will use by value referencing when you do not want the variable to change.


By reference is when you pass the variable itself into the function.

You will use such referencing when you require the variable to change.


My teacher told us that it is not enough to say that passing by reference does not change a variable and passing by value does, so you will need to say that a copy is passed in for reference and the variable itself is passed in for value. So you need to include ALL of what Sodium Ho said. biggrin.gif


You got them the wrong way round tongue.gif

Other than that, your correct, in general the more you mention(ie better you know your KU), the better chance of an A Band 1, i got a Band 2 cos ididnt know certain parts well enough, but i do now lol

#6 Pammy

    Site Swot

  • Members
  • PipPipPipPip
  • 194 posts
  • Location:Glasgow(ish)
  • Interests:Swimming, music (listening and playin), goin to the flicks, shopping &lt;3, shoes, glitter, reading, flowers, msn, bowling for soup, westlife, bags and nailpolish
  • Gender:Female

Posted 27 May 2006 - 12:44 PM

QUOTE(Sodium_Ho @ May 27 2006, 12:41 PM) View Post


You got them the wrong way round tongue.gif



Haha lol sorry !!!!!!!!!!!!!!!!
Everyone, just copy exactly what Sodium Ho said !!!!!!!!!!!!!!!!!!!!!
*~* Kiss me, beneath the milky twilight, lead me, out on the moonlit floor, lift your open hand, strike up the band and make the fireflies dance, silver moon sparkling, so kiss me *~*

#7 John

    HSN Legend

  • Members
  • PipPipPipPipPipPipPipPip
  • 2,713 posts
  • Location:In a Peripheral Estate in Glasgow
  • Interests:First the boring stuff:<br /><br />2004 Results:<br /><br />Highers:<br /><br />Computing A<br />Craft and Design A<br />Physics A<br />Administration A<br />English A<br />Maths A<br />Modern Studies A<br />French A<br /><br />2005 Results:<br /><br />Advanced Highers:<br />Computing A<br />Physics A<br />Maths A<br />Modern Studies A<br />English A<br /><br />2006 Results:<br /><br />Advanced Highers(All Crashed):<br />Chemistry A<br />Biology A<br />Business Managemnt A<br /><br />Aren't I marvellous?
  • Gender:Male

Posted 27 May 2006 - 12:48 PM

QUOTE(Pammy @ May 27 2006, 01:44 PM) View Post

QUOTE(Sodium_Ho @ May 27 2006, 12:41 PM) View Post


You got them the wrong way round tongue.gif



Haha lol sorry !!!!!!!!!!!!!!!!
Everyone, just copy exactly what Sodium Ho said !!!!!!!!!!!!!!!!!!!!!


Some great advice right there laugh.gif tongue.gif

#8 dontcrytonight

    Showing Improvement

  • Members
  • PipPip
  • 13 posts
  • Gender:Female

Posted 27 May 2006 - 02:31 PM

klkl thanx guyss!!
memorisin that mwahhaha lol





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users