User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 426,513 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,119 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 18016 | Replies: 1
Reply
Join Date: Mar 2005
Posts: 1
Reputation: tw0nk is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tw0nk tw0nk is offline Offline
Newbie Poster

C++ pass 2d array into function

  #1  
Mar 22nd, 2005
Hi I am getting this error with my code as I try to pass a 2d array into a function :

mymain.cpp:173: error: cannot convert `float (*)[((dimensions - 1) + 1)]' to `float**' for argument `1' to `float objfunc(float**)'])'

The code is as follows:

http://cpp.sourceforge.net/?show=4356

The lines 0030, 173 and 282 are where the problems are,

If anyone could be of any help i woule be extremely gratefull as I have been stuck on it for quite a while now. thanks in advance.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2004
Posts: 6,324
Reputation: Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of 
Rep Power: 28
Solved Threads: 458
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Expert Meanie

Re: C++ pass 2d array into function

  #2  
Mar 22nd, 2005
When an array name is used, it is usually converted to a pointer to the first element. This only works for the first dimension, so you're actually passing a pointer to an array of size dimensions, not a pointer to a pointer to float.
I'm a programmer. My attitude starts with arrogance, holds steady at condescension, and ends with hostility. Get used to it.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 6:00 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC