what is pointer



what is pointer..

Answer / vignesh1988i

a pointer is an memory location in which it holds a particular ADDRESS of a particular data type. and mean while through the ADDRESS it will point to that corresponding value in that data typed variable.
DECLARATION OF A POINTER VARIABLE :
int *pointer_variable;

for eg:
int a=45; //line 1
int *b; // line 2
b=&a; //line 3
printf("%d\n",*b); //line 4

explanation:

line 1 :
consider let address of the location 'a' be 1000, which contains a value 45 of integer data type.
line 2 :
*b , represents the integer pointer which can hold an integer variable address.
line 3 :
when we take any variable such as int a or int c etc, when we call as 'a' we will refer to the content inside 'a' (for eg.),in the same way as in the above coding *b is given . but b=&a; this means when we call 'b' the content (ie) the address of variable 'a', and that 'b' will be pointing indirectly the value of 'a' through the 'a's address.
line 4 :
when we want to refer to that pointed value we must give as *pointer_variable & here *b when you give the same 45 will get printed.




thank u

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More C Interview Questions

Do string constants represent numerical values?

0 Answers  


What do you mean by dynamic memory allocation in c?

0 Answers  


Write a program to show the workingof auto variable.

2 Answers   Infotech,


post new interiew question and aptitude test papers

1 Answers  


Explain the use of keyword 'register' with respect to variables.

0 Answers  






What is the importance of c in your views?

0 Answers  


1.write a program to merge the arrays 2.write efficient code for extracting unique elements from a sorted list of array?

3 Answers   Qualcomm,


What are the advantages and disadvantages of pointers?

0 Answers  


c program to compute Income tax and Net Salary for its employees. The company offers tax relief of Kshs. 650 for single employees and Kshs. 1,100 for married employees. The relief will be deducted from the Gross salary, to give the taxable income. This will be computed at the following rates: [10mks] Taxable Income Rate (%) <5000 0 5000-19999 6 20000-36999 9 37000 and above 16

1 Answers  


how to do in place reversal of a linked list(singly or doubly)?

3 Answers  


Please write the area of a RIGHT ANGLED TRIANGLE.

1 Answers  


Explain logical errors? Compare with syntax errors.

0 Answers  


Categories