Teen Programmers Unite  
 

 

Return to forum top

Passing arrays in C++

Posted by shadow [send private reply] at January 11, 2002, 07:54:14 PM

I am rather new to porgramming in general, and have decided to do little problems to challenge myself and to just learn new things. I am curently working on the Cat in the Hat problem, and want to pass an array to a function to store and display data. I'll use my display function decleration and call as an example.

display_results(not_working, combined_height, i);
This is my functiom call
display_results(int &not_working[ ], int &combined_height [ ], int i);
My decleration.
Any suggestions would be nice. Thanks.

Posted by Psion [send private reply] at January 11, 2002, 09:53:42 PM

Leave out the &'s. Arrays are always passed "by reference" as pointers in C and C++.

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.