Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #12603
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.posted.grandecom!news.posted.grandecom.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Fri, 16 Dec 2011 18:46:03 -0600 |
| User-Agent | Microsoft-Entourage/12.23.0.091001 |
| Date | Fri, 16 Dec 2011 18:46:01 -0600 |
| Subject | Simple argument question |
| From | Bint <bint@ign.com> |
| Newsgroups | comp.lang.c++ |
| Message-ID | <CB114269.B5F7%bint@ign.com> (permalink) |
| Thread-Topic | Simple argument question |
| Thread-Index | Acy8VT94x54vN67uAkiZOLY0LJhwhA== |
| Mime-version | 1.0 |
| Content-type | text/plain; charset="US-ASCII" |
| Content-transfer-encoding | 7bit |
| Lines | 30 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 216.82.212.181 |
| X-Trace | sv3-uPgb4KcVHaa3R/urptCRrdixgMmgjM3u+aFA69h0KVRqgb/GWLKJUt+zTyI9losEAAtQFe4/3CfU0cF!pWkx4M6k621MuJbyvjX/8YnKU4ikazBgRPx5YRwmlCWMfMRTsAoIQFCdkUkYjPE= |
| X-Complaints-To | abuse@grandecom.com |
| X-DMCA-Complaints-To | abuse@grandecom.com |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2011 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:12603 |
Show key headers only | View raw
Hi can someone answer a simple question involving arguments to functions?
I need to call a library function which expects an argument like this
Function(double pointlist[][3]);
My question is how do I make one of those if I am just wanting to malloc the
memory? Can I use a double pointer?
Can I have something like this:
double *points = (double *)malloc(10*3*sizeof(double));
for int (j = 0; j < 10; j++) {
*(points + j*3 + 0) = x;
*(points + j*3 + 1) = y;
*(points + j*3 + 2) = z;
}
And then call the function with points as the argument? It doesn't compile
but I was wondering if I could cast it? Or do I need something else instead
of a double pointer for my points?
Does that make sense? I am confused about how to call the function with
anything but something like:
double array[500][3];
I don't want that because I don't know the number of points, see?
Thanks for any help!
B
Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread
Simple argument question Bint <bint@ign.com> - 2011-12-16 18:46 -0600
Re: Simple argument question "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-17 01:13 +0000
Re: Simple argument question Bint <bint@ign.com> - 2011-12-17 12:06 -0600
Re: Simple argument question "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-17 18:45 +0000
Re: Simple argument question "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-17 23:16 +0000
Re: Simple argument question jt@toerring.de (Jens Thoms Toerring) - 2011-12-18 22:07 +0000
Re: Simple argument question "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-18 22:34 +0000
Re: Simple argument question 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-17 00:13 -0800
Re: Simple argument question Juha Nieminen <nospam@thanks.invalid> - 2011-12-17 08:16 +0000
Re: Simple argument question 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-17 00:51 -0800
Re: Simple argument question Juha Nieminen <nospam@thanks.invalid> - 2011-12-17 10:23 +0000
Re: Simple argument question Goran <goran.pusic@gmail.com> - 2011-12-17 23:08 -0800
Re: Simple argument question Heck <heckja_in@ordertostymieharvestersverizon.net> - 2012-01-05 09:59 -0500
Re: Simple argument question Krice <paulkp@mbnet.fi> - 2011-12-18 00:46 -0800
Re: Simple argument question jt@toerring.de (Jens Thoms Toerring) - 2011-12-18 22:14 +0000
Re: Simple argument question Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-12-19 12:01 +0000
Re: Simple argument question Tobias Müller <troplin@bluewin.ch> - 2011-12-19 17:17 +0000
Re: Simple argument question Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-12-20 00:33 +0000
Re: Simple argument question Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-12-18 17:03 +0000
Re: Simple argument question 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-18 10:04 -0800
csiph-web