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.
#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:
Anonymous2010-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: