Passing a string array to a function using pointers

This is a discussion on Passing a string array to a function using pointers within the C++ Programming forums, part of the General Programming Boards category; I'm having trouble passing a string array to another function. I can pass an integer array like this Code: int ...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    4

    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
    Code:
     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
    Location
    California
    Posts
    3,267
    Post your code that demonstrates the problem you are having.

  3. #3
    "I Win!" by U. Lose vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,621
    and why are you using array and not vector in the first place?
    To be or not to be == true

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


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21