Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-05-2009
Member
 
Join Date: Dec 2008
Posts: 33
function that takes a 2D array as a parameter

hi,
I defined the following function:
Code:
p_direction scanning (points position, double heading, int circ [NC] [MC]) (....}
with

Code:
 struct (int s_point a; y-int);    
  typedef struct s_point * points; 
  s_direction struct (double s_ta; double s_dist_obst;); 
  typedef struct s_direction * p_direction;
I use my position as follows:
Code:
  p_direction d = scan (P1, PI / 2., circ [NC] [MC]);
but this warning appears: warning: passing argument 3 of 'scan' from incompatible pointer.Why? How do I fix this? Thank you in advance for the answer.
Reply With Quote
  #2  
Old 06-05-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: function that takes a 2D array as a parameter

Call it like this:

scanning (p1, PI / 2, circ);
Reply With Quote
  #3  
Old 06-05-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: function that takes a 2D array as a parameter

Code:
p_direction scanning (points position, double heading, int circ [NC] [MC]
You must send a pointer to a two dimensions to your function.
Code:
p_direction d = scan (P1, PI / 2., circ [NC] [MC]);
circ is the pointer, so if you send circ [x] [y] to your function (whatever x and y, since these boxes have been allocated), it retrieves this parameter as a variable int.

Code:
 p_direction d = scan (P1, PI / 2., circ);
This seems to be better, right?
Reply With Quote
  #4  
Old 06-05-2009
Member
 
Join Date: Dec 2008
Posts: 177
Re: function that takes a 2D array as a parameter

For a table with n dimensions it is necessary to clarify the last n-1, ie all except the first. Nevertheless it seems to me that the first is optional, ie that its accuracy is left to the programmer.
Reply With Quote
  #5  
Old 06-05-2009
Member
 
Join Date: Dec 2008
Posts: 33
Re: function that takes a 2D array as a parameter

I specify only the 2nd dimension of the table:

Code:
  p_direction scanning (points position, double cap, circ int [TM])
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "function that takes a 2D array as a parameter"
Thread Thread Starter Forum Replies Last Post
Parameter function and generic pointer Rubero Software Development 7 25-09-2010 09:04 PM
Pointer parameter in a function Chrisch Software Development 4 14-12-2009 10:57 PM
Matrix parameter function Chrisch Software Development 3 02-12-2009 11:07 AM
Passing function parameter and static Banjiji Software Development 3 27-10-2009 07:32 PM
Pass an array as parameter via URL param Cadallic Technology & Internet 3 25-07-2009 12:15 PM


All times are GMT +5.5. The time now is 06:59 PM.