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

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: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;
}

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