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 Newsgroups: comp.lang.c++ Message-ID: 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 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