473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to pass an array 2-D

I have this function:

double calcolo_errore (gsl_vector_complex *w_k, int
elementi,gsl_vector_complex *steering_vector_c_t, int teta_l, int
teta_r, int fi_r, int fi_l, int counter, double f_k_piu_uno[][])
{
int fi_j, teta_i ;
double valore_errore ;

for (teta_i = 0 ; teta_i <= 90 ; teta_i++)
{
for (fi_j = 0 ; fi_j <= 360 ; fi_j++)
{
valore_errore += f_k_piu_uno [teta_i][fi_j] * pow (fabs
(calcolo_P_y_k (w_k, elementi, steering_vector_c_t) -
calcolo_P_riferimento (teta_i, fi_j, teta_l, teta_r, fi_r, fi_l)), 2) ;
}
}
printf ("\nCiclo: %d, Errore = %lf\n\n", counter, valore_errore) ;

return valore_errore ;
}

i receive the error message:

implementazione_algoritmov6.c:397: error: invalid use of array with
unspecified bounds

the row 397 is:

valore_errore += f_k_piu_uno [teta_i][fi_j] * pow (fabs
(calcolo_P_y_k (w_k, elementi, steering_vector_c_t) -
calcolo_P_riferimento (teta_i, fi_j, teta_l, teta_r, fi_r, fi_l)), 2) ;

Can't i use the writing with "[][]" in a function to have an element of
a vector?
what alternatives have i?
Thank u, Marco.

Jan 9 '06 #1
2 1733
Aleramo wrote:
I have this function:

double calcolo_errore (gsl_vector_complex *w_k, int
elementi,gsl_vector_complex *steering_vector_c_t, int teta_l, int
teta_r, int fi_r, int fi_l, int counter, double f_k_piu_uno[][])
<snip>
^^^^^^^^^^^^^^^^^^^^^^ Can't i use the writing with "[][]" in a function to have an element of
a vector?
what alternatives have i?


This is your problem. You can only leave out the sive on the left most
[], for the others you have to specify the size. After all, how else is
the compiler to know how long each row of your 2d matrix is? See the
comp.lang.c FAQ, specifically http://c-faq.com/aryptr/pass2dary.html
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Jan 9 '06 #2
Thank u Flash!!!

now it works!!!

Jan 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Seeker | last post by:
Newbie question here... I have a form with some radio buttons. To verify that at least one of the buttons was chosen I use the following code ("f" is my form object) : var btnChosen; for...
6
by: Kenny | last post by:
Hello, can anyone tell me how to pass an array to a function ? I have this function , part of my class. It works if I do not put in int a everywhere , but obviously , I need to add an array so I...
7
by: ritchie | last post by:
Hi all, I am new to this group and I have question that you may be able to help me with. I am trying to learn C but am currently stuck on this. First of all, I have a function for each sort...
5
by: wilson | last post by:
Dear all, In this time, I want to pass array to function. What should I declare the parameter in the function?i int array or int array? Which one is correct? ...
10
by: nospam | last post by:
Hello! I can pass a "pointer to a double" to a function that accepts double*, like this: int func(double* var) { *var=1.0; ... }
3
by: Boni | last post by:
Dear all, I have written a C++ com object: STDMETHOD(myfunc)(INT* array) Now I need to pass an array from c# to com. I generated a COM interop and it the signature of the function is ...
14
by: Abhi | last post by:
I wrote a function foo(int arr) and its prototype is declared as foo(int arr); I modify the values of the array in the function and the values are getting modified in the main array which is...
3
by: QQ | last post by:
I have one integer array int A; I need to pass this array into a function and evaluate this array in this function how should I pass? Is it fine? void test(int *a)
11
by: venkatagmail | last post by:
I have problem understanding pass by value and pass by reference and want to how how they are or appear in the memory: I had to get my basics right again. I create an array and try all possible...
29
by: Why Tea | last post by:
Suppose you have a 2-dimensional array (matrix) in main() and you want to pass it to a function to do some processing, you usually pass it as a pointer to the first element. But, from the function,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.