Thread: passing by reference

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    141

    passing by reference

    Could anyone please let me know the syntax for passing an array of strings by reference?

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Regarding your recent flurry of threads: please post a (reasonably small) compileable example that demonstrates your initial attempt to find a solution -- including an actual (small, simplified, if possible) example of input and output.

    Goal: the big picture (what are you actually trying to do)? Sometimes tossing parts of problems with perceived potential solutions leaves you with a bad solution.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    141
    This is an answer I don't know!I know for int i use &int but what to use for an array of strings!

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    You've posted about 20+ times without posting the code that you have written as an attempt. You are starting to look like a leech.

    There is no pass by reference in C. Instead you pass a pointer to simulate pass by reference.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Registered User
    Join Date
    Jan 2006
    Location
    Berkeley, Ca
    Posts
    195
    C doesn't have pass by reference. Just call by value. In some vague respects, you can emulate pass by reference(like the C++ pass by reference) by using pointers, but it is still call by value in C.

    Passing a pointer using call by value in C and passing a reference in C++ are two fundamentally different beasts.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM