Urgent Help required - should be easy 
Author Message
 Urgent Help required - should be easy

Hi.  I have an assignment which must be completed ASAP.  It involves
using pointers in C.  We are working on a Unix platform.

The first problem that I have is passing a structure as a parameter -
it is an array of structures which I need to pass as a parameter to a
sort function.

Secondly, once I have this working, I then need to convert the whole
program to use pointers to this array (it is global at the moment).

Can anyone help me ?


which I am stuck with - it is only ~150 lines.

Thanks
Richard

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 09 Sep 2002 03:00:00 GMT  
 Urgent Help required - should be easy

<snip>

Quote:

> which I am stuck with - it is only ~150 lines.

Just post your code here -- you really shouldn't rely on email.  How do
you know that the person replying to your question has any idea of what
is going on?  By posting here, any errors made by anyone should be
spotted...

Cheers,
Selim
--
"Mille millions de mille sabords!"
Capitaine Haddock



Mon, 09 Sep 2002 03:00:00 GMT  
 Urgent Help required - should be easy

Quote:

> Hi. I have an assignment which must be completed ASAP. It involves
> using pointers in C. We are working on a Unix platform.

> The first problem that I have is passing a structure as a parameter -
> it is an array of structures which I need to pass as a parameter to a
> sort function.

typedef struct
{
  int x;
  int y;

Quote:
}FOO;

void sortfunction(FOO *data, int N);

/* in code */
FOO bar[123];
/*
sortfunction(bar, 123);

Quote:

> Secondly, once I have this working, I then need to convert the whole
> program to use pointers to this array (it is global at the moment).

int main(void)
{
  FOO bar[123];

  f1(bar, 123);
  sortfunction(bar, 123);
  cleanup(bar, 123);
  return 0;

Quote:
}

/*
  f1 - initialisation function - sets x to 0 and y to a random number.
*/
void f1(FOO *data, int N)
{
  int i;
  for(i=0;i<N;i++)
  {
    data[i].x = 0;
    data[i].y = rand() % 1234;
  }

Quote:
}
> Can anyone help me ?


> which I am stuck with - it is only ~150 lines.

> Thanks
> Richard

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Mon, 09 Sep 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Easy Help Required

2. Easy Help Required

3. URGENT help required on searching within a character array

4. URGENT Help required for C program!!!!!

5. URGENT help required on searching within a character array

6. urgent help required

7. Urgent Help Required: date arithmetic

8. Hello Group - Urgent help required

9. URGENT HELP REQUIRED

10. URGENT required help on SetTimer problem!

11. urgent help required for the closing dialog box from the tab control

12. Urgent help required

 

 
Powered by phpBB® Forum Software