This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: How to pass 2D variable-sized arrays in C++?
- From: "Quang Nguyen (Ngo)" <quang dot nguyen at tapeware dot com>
- To: 'Jason Mancini' <jayrusman at hotmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Thu, 26 Sep 2002 08:25:53 -0700
- Subject: RE: How to pass 2D variable-sized arrays in C++?
Hi Jason,
Try this:
void func(int c, int r, float f[][])
{
printf("hello\n");
}
main()
{
int c = 5, r = 7;
float f[r][c];
func(c, r, f);
}
--
Quang
-----Original Message-----
From: Jason Mancini [mailto:jayrusman@hotmail.com]
Sent: Wednesday, September 25, 2002 7:37 PM
To: gcc-help@gcc.gnu.org
Subject: How to pass 2D variable-sized arrays in C++?
Hello,
How does one type the 2D variable size array "f" below?
I've tried nasty casts that all get rejected, cheating
with void, etc, etc. Very stumped! Sure, I could back
up to a real float** and manually new[] and pass float**,
but that takes all the fun out!
Thanks,
Jason
void function(int c, int r, ??? f )
{
}
main() {
int c(5), r(7);
float f[r][c];
function(c, r, f);
};
--
_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail.
http://www.hotmail.com
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________