| www.delorie.com/archives/browse.cgi | search |
| From: | aho450s AT nic DOT smsu DOT edu (Tony O'Bryan) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: NEED HELP passing multi-dim arrays to functions |
| Date: | Mon, 03 Feb 1997 14:51:46 GMT |
| Organization: | Southwest Missouri State University |
| Lines: | 35 |
| Message-ID: | <32f5faeb.2539478@ursa.smsu.edu> |
| References: | <5d2sdh$jhj AT News DOT Dal DOT Ca> |
| NNTP-Posting-Host: | forseti.i142.smsu.edu |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Try this:
#include <iostream.h>
void print_array(int [][3]);
void main()
{
int array1[3][3];
array1[0][0] = 1;
array1[0][1] = 2;
array1[0][2] = 3;
array1[1][0] = 4;
array1[1][1] = 5;
array1[1][2] = 6;
print_array(array1);
}
void print_array(int par_array1[][3])
{
cout << "array1[0][0]:\t" << par_array1[0][0] << endl;
cout << "array1[0][1]:\t" << par_array1[0][1] << endl;
cout << "array1[0][2]:\t" << par_array1[0][2] << endl;
cout << "array1[1][0]:\t" << par_array1[1][0] << endl;
cout << "array1[1][1]:\t" << par_array1[1][1] << endl;
cout << "array1[1][2]:\t" << par_array1[1][2] << endl;
}
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |