C Programming


Practise Exercise 10: Pointers
1. Declare a pointer to an integer called address.


	int *address;

2. Assign the address of a float variable balance to the float pointer temp.


	temp = &balance;

3. Assign the character value 'W' to the variable pointed to by the char pointer letter.


	*letter = 'W';

4. What is the output of the following program segment?


	int  count = 10, *temp, sum = 0;

	temp = &count;
	*temp = 20;
	temp = ∑
	*temp = count;
	printf("count = %d, *temp = %d, sum = %d\n", count, *temp, sum );

	count = 20, *temp = 20, sum = 20

5. Declare a pointer to the text string "Hello" called message.


	char *message = "Hello";


ęCopyright B Brown. 1984-1999. All rights reserved.