Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. In your own words, what is a C pointer? 2. Given the following information, f

ID: 643352 • Letter: 1

Question

1. In your own words, what is a C pointer?

2. Given the following information, fill in the blanks in the Statement and Output columns. For the output, just provide the number, not the entire printf string.

Statement

Output

printf ("The direct value of nump1 is: %d ",        );

printf ("The direct value of num2 is: %d ",         );

printf ("The address of num2 is: %d ",                );

printf ("The contents of nump2 is: %d ",           );

printf ("The indirect value of nump1 is: %d ",               );

3. Is it possible to indirectly return more than one value from a function through output parameters/pointers? Explain.

Statement

Output

printf ("The direct value of nump1 is: %d ",        );

printf ("The direct value of num2 is: %d ",         );

printf ("The address of num2 is: %d ",                );

printf ("The contents of nump2 is: %d ",           );

printf ("The indirect value of nump1 is: %d ",               );

1. In your own words, what is a C pointer? 2. Given the following information, fill in the blanks in the Statement and Output columns. For the output, just provide the number, not the entire printf string.

Explanation / Answer

Solution 1:

Pointers in C are easy and fun to learn. Some C programming tasks are performed more easily with pointers, and other tasks, cannot be performed without using pointers such as dynamic memory allocation. So it becomes necessary to learn pointers to become a perfect C programmer.

Every variable is a memory location and every memory location has its address defined which can be accessed using ampersand (&) operator, which denotes an address in memory.

Eg:

#include <stdio.h>

Int main

{

Int a,b;

printf(