Pointers Interview Questions with Answers

C Pointers Interview Questions with Answers Frequently Asked:

[1] For C version, how many memory cells are needed to store a single character, an integer quantity, a floating-point and a double precision quantity ?


Memory cells Needed   Variable type
Character  8 bits (1 byte)
Integer  2 bytes
Floating-point  4 bytes
Double precision  8 bytes

[2] What is ment by the address of a memory cell ? How these addresses are usually numbered ?


Adjacent memory cells within a computer are numbered consecutively, from the beginning to the end of the memory area. The number associated with each memory cell is known as the memory cell’s address.

[3] How do you determine the address of a variable in C ?


Let us consider a variable, v. Its address  can be determined by the expression &v. Here & is a unary operator. This is called address operator. This address operator evaluates the address of its variable.

[4] What information can be represented by a pointer variable ?


The pointer variable represents the location where the variable, v is stored in the memory.

[5] Tell about the relationship between the address of a variable and its corresponding pointer variable ?


Let v be the variable and pv be the pointer variable.

Here, variable v represents a value. pv represents the address of the variable v.

i.e., pv=&v (&=address), v=*pv (* = data represented by the address pv).

[6] Tell about indirection operator ?


The value of the variable v is accessed using the expression *pv. Here we know that the pv is the address. * is the unary operator called indirection operator. This operates only on pointer. Note: Both *pv and v represents value of v.

[7] How do you declare a pointer variable ?



data_type  *ptvar;

here, ptvar is the pointer variable. * is the indirection variable. *ptvar used to access the data at the address denoted by the pointer variable.

[8] Why is it sometimes desirable to pass a pointer to a function as an argument ?


When an argument is passed by value, the changes made to that argument within the function is not takes to the calling function. At the same time, if ir is passed as reference, i.e. passed as pointer, it can be accessed freely from the memory location. Hence the changed value of that argument is used globally. Hence it is desirable to pass an argument as a pointer.

[9] Tell about the relation between an array name and a pointer ?


Aray name is the pointer to the first element of that array. pointer points to the address of a single variable.

x[i] and *(x+i) represents the value of the i-th element of the array x. x[i] =array, *(x+i)= pointer.

[10] What kind of objects can be associated with pointer variables ?


A pointer variable can point to a numeric, character variables, array, functions or other pointers. It can also assign to a null value.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *