Thread: Passing a string array to a function using pointers

  1. #1
    Registered User
    Join Date
    Apr 2009

    Passing a string array to a function using pointers

    I'm having trouble passing a string array to another function. I can pass an integer array like this
     int main(){
    int numbers[3] = {1,2,3};
    void print_array (int*array);
    print_array (numbers);
    void print_array (int*array){
    	cout << (*array) << (*array+1);
    however, I can't seem to change it so that I am able to pass a string array.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Post your code that demonstrates the problem you are having.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    and why are you using array and not vector in the first place?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 10-15-2008, 03:08 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  5. I need help with passing pointers in function calls
    By vien_mti in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 10:00 AM

Tags for this Thread