Re: integer to characters

From: Gene Wirchenko (gwirchenkoEXCEPT_at_CAPITALSwencomine.com)
Date: 10/23/03


Date: Thu, 23 Oct 2003 00:05:36 GMT

On Wed, 22 Oct 2003 23:40:52 GMT, Default User
<first.last@boeing.com.invalid> wrote:

>Gene Wirchenko wrote:
>>
>> On Wed, 22 Oct 2003 22:38:24 GMT, Martin Ambuhl
>> <mambuhl@earthlink.net> wrote:
>>
>> [snip]
>>
>> >int main(void)
>> >{
>> > int x[3] = { 123, 23, 3 };
>> > char buf[BUFSIZ], *p;
>> > size_t i;
>> > for (i = 0; i < sizeof x / sizeof *x; i++) {
>> ^^^^^^^^^
>> What does this mean? I can not help but read it as the size of
>> an int * *. I would have written "sizeof(int)".
>
>How would you get a pointer to pointer from applying the dereferencing
>operator to a pointer?

     I was looking at an asterisk. You can easily get a pointer with
an asterisk. I have never seen sizeof used like that before.

>> Please explain as I am missing something if this is real code.
>
>Yes, that divides the size of an entire array but the size of one
>element, giving the number of elements in the array. Only works with
>real arrays.

     I know that part of it.

Sincerely,

Gene Wirchenko