Results 1 to 5 of 5

Thread: passing paramaters

  1. #1

    Thread Starter
    Addicted Member dolor's Avatar
    Join Date
    Sep 2002
    Location
    in a place seldom found on a map
    Posts
    220

    passing paramaters

    Anyone wanna explain to me the three ways of passing paramaters? I just started my C programming class, and we were talking about paramaters and I fell asleep cuz my teacher is an anus. Anyways...he said someting about values and reference and other stuff, and I have no idea what he's talking aboout. So, a brief explanation wouldn't hurt...thanks.
    - you've been privileged to read a post by Miz

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    when you alter parameters passed by reference you alter the originally passed variable, when you alter parameters passed by value, you only alter a copy of the variable passed to the function. When you pass a pointer, you can alter the value to which the pointer points to, while the pointer itself is only a copy unless you pass it by reference.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I only know of 2 ways in C to pass parameters...

    3 in C++, but only 2 in C and only 2 in theory.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    yeah true, that makes C++ less abstract than C in this aspect.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, only backwards compatible.

    References are an abstraction of pointers, but pointers were kept, this is why there are 3 ways now.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width