C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 04-13-2009, 11:18 AM   #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.
asofaihp is offline   Reply With Quote
Old 04-13-2009, 11:21 AM   #2
Registered User
 
Join Date: Sep 2004
Location: California
Posts: 2,845
Post your code that demonstrates the problem you are having.
bithub is offline   Reply With Quote
Old 04-13-2009, 11:31 AM   #3
CSharpener
 
vart's Avatar
 
Join Date: Oct 2006
Posts: 5,242
and why are you using array and not vector in the first place?
__________________
If I have eight hours for cutting wood, I spend six sharpening my axe.
vart is offline   Reply With Quote
Reply

Tags
array, pass, pointers, string

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
passing array of pointers from one function to another iunah C Programming 9 10-15-2008 03:08 AM
Screwy Linker Error - VC2005 Tonto C++ Programming 5 06-19-2007 02:39 PM
Unknown Memory Leak in Init() Function CodeHacker Windows Programming 3 07-09-2004 09:54 AM
Quick question about SIGSEGV Cikotic C Programming 30 07-01-2004 07:48 PM
I need help with passing pointers in function calls vien_mti C Programming 3 04-24-2002 10:00 AM


All times are GMT -6. The time now is 05:18 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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