Re: function returning days of the week
- From: rlb@xxxxxxxxxxxxxxxxxxxxxx (Richard Bos)
- Date: Mon, 31 Dec 2007 10:27:25 GMT
ssylee <stanigator@xxxxxxxxx> wrote:
I need to write a function that would read in a byte that would return
a number between 1 to 7, 1 being Sunday, 2 being Monday, etc. I want
to return an actual string that says "Sunday", or "Monday", etc.
corresponding to the number. I know that the best method to implement
a lookup conversion table would be using switch(variable ) ... case
x: .... structure. However, I may need to pass an array as one of the
parameters in order to access the text itself. Is there anything
inefficient in passing a character array as a parameter based on
memory consumption on an embedded microprocessor system? Thanks.
You can't pass arrays in C (unless you're being willfully counter-
productive by stuffing it inside a struct); what you will be passing is
a pointer to the first element. And no, that is not inefficient.
Richard
.
- References:
- function returning days of the week
- From: ssylee
- function returning days of the week
- Prev by Date: Re: Bandwidth stealing
- Next by Date: Re: Cannot compile with _FILE_OFFSET_BITS = 64
- Previous by thread: function returning days of the week
- Next by thread: Re: function returning days of the week
- Index(es):