Re: integer to characters

From: Default User (first.last_at_boeing.com.invalid)
Date: 10/23/03


Date: Wed, 22 Oct 2003 23:40:52 GMT

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?
 
> 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.

Brian Rodenborn



Relevant Pages

  • Re: Warning on assigning a function-returning-a-pointer-to-arrays
    ... This declares pfunc as a function taking no arguments and returning ... int x, y; ... Presumably pfuncwill return a pointer to a single int, ... or the first of a sequence of "array 5 of int"s. ...
    (comp.lang.c)
  • Re: The question regarding type of pointers
    ... int day_of_year ... According to my understanding daytab is pointing to the whole daytab ... array i.e it is equivalent to p3. ... daytab is converted to a pointer to the first ...
    (comp.lang.c)
  • Re: How would you design Cs replacement?
    ... I would get rid of void. ... a member called size of type int. ... size of the array pointed at by v->dynamic is given by int size. ... If you pass an unsized pointer to a sized parameter, ...
    (comp.lang.c)
  • Re: Newbie
    ... to talk about the int value 3 and the int value 4, ... It also lets you talk about pointer ... C has a special rule for array objects. ... to printf() is: ...
    (comp.lang.c)
  • Re: union {unsigned char u[10]; ...}
    ... But character type is not a union. ... u.a is of type int. ... has to do so to make pointer equality work consistently). ... were a single-element array. ...
    (comp.lang.c)