On Oct 12, 1:08*pm, Keith Thompson <ks...@mib.org> wrote:
> fgg <fabioguimaraesgoncal...@gmail.com> writes:
> > I'd like to populate the 4x3 array below using the function "function"
> > to determine the value of each element. This function takes 2
> > arguments, which will vary in a systematic way (see below). How can I
> > use for loops in C to accomplish this task? Thanks.
>
> > function(20,0.1) *function(20,0.2) *function(20,0.3)
> > function(21,0.1) *function(21,0.2) *function(21,0.3)
> > function(22,0.1) *function(22,0.2) *function(22,0.3)
> > function(23,0.1) *function(23,0.2) *function(23,0.3)
>
> Please give us your instructor's e-mail address so we can submit our
> solutions directly.
>
> Alternatively, what have you tried, and how did it not work?
>
> --
> Keith Thompson (The_Other_Keith) ks...@mib.org *<http://www.ghoti.net/~kst>
> Nokia
> "We must do something. *This is something. *Therefore, we must do this."
> * * -- Antony Jay and Jonathan Lynn, "Yes Minister"
This is a small piece of my first program in C. I know I need two
nested loops (one for the function and one for the array), but I don't
really know how to integrate them. Here are the pieces I have so far:
int row, col;
float i, j;
float array[4][3];
for (col = 0; col < 3; col++)
for (row = 0; row < 4; row++)
???
for (j = 0.1; j < 0.4; j = j + 0.1)
for (i = 20; i < 24; i++)
???
array[col][row] = function(i,j);
BTW, here's my instructor's email address:
.c