

The initializations are equivalent.Clang++ -Wall -g -std=c++0x -stdlib=libc++ -U_STRICT_ANSI_ -c -I include -I /usr/local/include -DENABLE_BIOT023_IDS -DBOOST_TEST_DYN_LINK -o test/test_runner.o test/test_runner.cppĬlang++ -Wall -g -std=c++0x -stdlib=libc++ -U_STRICT_ANSI_ -c -I include -I /usr/local/include -DENABLE_BIOT023_IDS -DBOOST_TEST_DYN_LINK -o test/game_factory_test.o test/game_factory_test.cpp The first pointer, proundup, is initialized using only the name of the function, while the second, pround, uses the address-of operator in the initialization. Once the function roundup is declared, two pointers to roundup are declared and initialized. This example shows equivalent ways of declaring a pointer to a function: int roundup( void ) /* Function declaration */ This example demonstrates that the result of applying the indirection operator to the address of x is the same as x: assert( x = *&x ) The value is assigned to the integer variable x: x = *pa The indirection operator ( *) is used in this example to access the int value at the address stored in pa. The result is stored in the pointer variable pa: pa = &a This statement uses the address-of operator ( &) to take the address of the sixth element of the array a. The following examples use these common declarations: int *pa, x Otherwise, the result is a pointer to the object or function designated by the operand. The result has the same effect as removing the & operator and changing the operator to a + operator. If the operand is the result of a operator, the & operator and the unary * implied by the operator aren't evaluated. The result isn't an lvalue, and the constraints on the operators still apply. If the operand is the result of a unary * operator, neither operator is evaluated and the result is as if both were omitted.


The result is of type pointer to operand_type for an operand of type operand_type. The result of a unary dereference ( *) or array dereference ( ) operator. The operand must be one of these things:Īn lvalue that designates an object that isn't declared register and isn't a bit-field. The unary address-of operator ( &) gives the address of its operand. The pointer specifies an address not used by the executing program. The pointer specifies an address that's inappropriately aligned for the type of the object pointed to. (For example, an object that's gone out of scope or that's been deallocated.) The pointer specifies the address of an object after the end of its lifetime at the time of the reference. Here are some of the most common conditions that invalidate a pointer value:

If the pointer value isn't valid, the result of the indirection operator is undefined. If it points to an object, the result is an lvalue that designates the object. If the operand points to a function, the result is a function designator. The result of the indirection operator is type if the operand is of type pointer to type. The type of the result is the type that the operand addresses. The result of the operation is the value addressed by the operand that is, the value at the address to which its operand points. The unary indirection operator ( *) accesses a value indirectly, through a pointer.
