Re: integer to characters

From: Gene Wirchenko (
Date: 10/23/03

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

On Wed, 22 Oct 2003 23:40:52 GMT, Default User
<> wrote:

>Gene Wirchenko wrote:
>> On Wed, 22 Oct 2003 22:38:24 GMT, Martin Ambuhl
>> <> 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.


Gene Wirchenko

Relevant Pages

  • Re: char **argv & char *argv[]
    ... "pointer to pointer to char". ... >> pointer)) pointing to the first element of an array. ... so we have to start adding more context. ... type "pointer to char", rather than "array MISSING_SIZE of char". ...
  • Re: Who owns the variable in my header file ?
    ... to check the subscripts to the array and trap on error conditions. ... cast one type of pointer into another; you wouldn't then be able to step ... language trying to be C like, ... One reason being that the programmer can possible ...
  • Re: why cannot assign to function call
    ... hypothetical C-like languages, ... sizeof business would still indicate that a pointer was being passed. ... talk about variables of an array type. ... the earlier version of the standard didn't have numbered ...
  • Re: multi dimensional arrays as one dimension array
    ... please - where does the standard say that such a conversion ... Pointer conversion yields a pointer to the same object as ... exist only where there are array declarations. ...
  • Re: Pointer Equality for Different Array Objects
    ... Pointers to the same object are pointers to the same region of data storage. ... A pointer comaprison (for exact equality, ... we have the vague ("if the array is large enough"). ...