C Pointer
ptr++; // Pointer moves to the next int position (as if it was an array)++ptr; // Pointer moves to the next int position (as if it was an array)
++*ptr; // The value of ptr is incremented
++(*ptr); // The value of ptr is incremented
++*(ptr); // The value of ptr is incremented
*ptr++; // Pointer moves to the next int position (as if it was an array). But returns the old content
(*ptr)++; // The value of ptr is incremented
*(ptr)++; // Pointer moves to the next int position (as if it was an array). But returns the old content
*++ptr; // Pointer moves to the next int position, and then get's accessed, with your code, segfault
*(++ptr); // Pointer moves to the next int position, and then get's accessed, with your code, segfault
C Function Designator
A function designator is an expression that has function type. Except when it is the operand of the sizeof operator or the unary & operator, a function designator with type ‘‘function returning type’’ is converted to an expression that has type ‘‘pointer to function returning type’’.
References
- C11 standard (ISO/IEC 9899:2011):
- 6.3.2.1 Lvalues, arrays, and function designators (p: 54-55)
- C99 standard (ISO/IEC 9899:1999):
- 6.3.2.1 Lvalues, arrays, and function designators (p: 46)
- C89/C90 standard (ISO/IEC 9899:1990):
- 3.2.2.1 Lvalues and function designators
沒有留言:
張貼留言