Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

A.7.4.3 Indirection Operator

Name: Anonymous 2010-09-03 9:01

The unary * operator denotes indirection, and returns the object or function to which its operand points. It is an lvalue if the operand is a pointer to an object of arithmetic, structure, union, or pointer type. If the type of the expression is ``pointer to T," the type of the result is T.

How would you interpret the bold lines. Please post examples.

Does it says that * has an idempotent property?

Name: Anonymous 2010-09-03 9:03

Oh wait. I fail. Fuck it; delete this thread.

Name: Anonymous 2010-09-03 9:12


#include <stdio.h>
int main(void) {
    char a = 'x';   /* declare `a' as char and initialize it with 'x' */
    char *p = &a;   /* declare `p' as pointer to char and let it point to `a' */
    putchar(*p);    /* print the char by using the indirection operator to "fetch" the value at the memory address pointed to by `p' */
    return 0;
}

Name: Anonymous 2010-09-03 9:28

In C, the indirection operator is actually idempotent when applied to a function pointer, due to 6.3.2.1p4. For example, the following program is fine:

void f(void) {}
int main(void) {
  (********f)();
}

Name: Anonymous 2010-09-03 9:30

>>3
I know. I read the 2nd sentence to fast, so I got confused by reading the last sentence. Just sage or delete this.

Name: Anonymous 2010-09-03 9:39

>>5
Oh, there's no escape. This thread will exist forever.

Name: Anonymous 2010-09-03 9:47

>>6 [b]D:[/b]

Name: Anonymous 2010-09-03 9:49

>>7
Oh yeah. By the way, now that I'm on fire, let's have some more fail from me.

Name: ​​​​​​​​​​ 2010-10-24 19:01

Name: Anonymous 2011-02-04 14:08

Name: Anonymous 2011-02-17 20:00

dubz

Don't change these.
Name: Email:
Entire Thread Thread List