Re: A little help please

From: Alwyn (alwyn_at_blueyonder.co.uk)
Date: 12/28/04


Date: Tue, 28 Dec 2004 14:03:11 +0000

On Tue, 28 Dec 2004 13:48:44 +0000, Alwyn wrote:

> On Tue, 28 Dec 2004 12:36:34 +0000, Rich wrote:
>>
>> I think I need to be doing the static_cast again in the function to cast
>> back to an int.
>
> No. 'arrX' is already an array of 'int', so no casting could possibly be
> required.

I think I misunderstood you there. I thought you meant you needed to cast
to 'int' before printing.

Actually, the question says:
> The function should set each byte in the specified range to the value.

To do that, you should cast to 'char *' or 'unsigned char *', which are
both byte-sized.

Anyway, just study my example. I believe it does what is required.

Alwyn



Relevant Pages

  • Re: [C] problem displaying string
    ... character and printing it with the %d format. ... >typedef struct bigint { ... >int main ... > bigint nines, subtrahend, diff; ...
    (alt.comp.lang.learn.c-cpp)
  • Re: offscreen rendering in Linux
    ... I'm trying to get printing my OpenGL scenes of aUCBLogo to work ... Instead of a Pixmap use a PBuffer. ... int scrnum = DefaultScreen; ...
    (comp.graphics.api.opengl)
  • Re: Time to ask?
    ... I am using X-code to compile this....not sure if this has anything ... int getch; ... so I have to assume that it isn't hanging. ... Printing line 1 ...
    (comp.lang.c)
  • Re: game of life
    ... > int config = s.nextInt; ... setting up a board configuration ... printing the next generation ... you initialize the increment counter within the loop, ...
    (comp.lang.java.programmer)
  • Re: How it works?
    ... The following code is working fine and printing the string "Mohan S". ... int main ...
    (comp.lang.c)