[C] determining size of an array in a function
From: Marlene Stebbins (stebbins_at_email.com)
Date: 06/25/04
- Next message: Gianni Mariani: "Re: [C] determining size of an array in a function"
- Previous message: Edo: "Re: AC++ Exercise 5-1 permuted index"
- Next in thread: Gianni Mariani: "Re: [C] determining size of an array in a function"
- Reply: Gianni Mariani: "Re: [C] determining size of an array in a function"
- Reply: David White: "Re: [C] determining size of an array in a function"
- Reply: Jerry Coffin: "Re: [C] determining size of an array in a function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 24 Jun 2004 22:57:34 GMT
My program performs several statistical tests on a list of
numbers. For example:
double stdev(double *arglist, int listsize); /* prototype */
double data[] = {76.9, 45.5, 32, 99.6, 12, 56.2, 79.9, 81};
int listsize = sizeof(data) / sizeof(*data);
double s = stdev(data, listsize);
The function needs to know the size of the array, so I am passing
it as an argument. I am wondering if there is any way for the
size of the the array to be determined in the function -- without
a global variable or a kludge -- so I can eliminate the 2nd
argument in the call to stdev(). I think there is no elegant way
to do this, but I thought I would ask the experts.
Marlene
- Next message: Gianni Mariani: "Re: [C] determining size of an array in a function"
- Previous message: Edo: "Re: AC++ Exercise 5-1 permuted index"
- Next in thread: Gianni Mariani: "Re: [C] determining size of an array in a function"
- Reply: Gianni Mariani: "Re: [C] determining size of an array in a function"
- Reply: David White: "Re: [C] determining size of an array in a function"
- Reply: Jerry Coffin: "Re: [C] determining size of an array in a function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|