1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
/************************************************************************
*
* Purpose: Demonstrate the Unary '&' and '*' operators.
* Unary & - Address of a variable.
* Unary * - Data at the address.
*
* These are not to be confused with their binary equivalents
* that perform bitwise AND and OR.
*
* Author: M J Leslie.
* Date: 16-Apr-94
*
************************************************************************/
main()
{
int i=4; /* variable declaration */
int* ptr; /* int pointer */
ptr = &i; /* 'ptr' now contains the
address of 'i' */
printf(" i is %d.\n", i);
printf("*ptr is %d.\n", *ptr);
}
|