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

What is far pointer in c?

0 Answers  


How can I find out the size of a file, prior to reading it in?

0 Answers  


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

0 Answers  


Why is malloc used?

1 Answers  


compare array with pointer?

1 Answers  






what is Structural oriented language? give some example of this language.....?

1 Answers  


What is a class?

3 Answers  


write a program to display the numbers in the following 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4

1 Answers  


What is storage class?

0 Answers  


what is ans for this scanf(%%d",c);

1 Answers  


What are pointers in C? Give an example where to illustrate their significance.

0 Answers   Wipro,


write a program to gat the digt sum of a number (et. 15= >1+5=6)

2 Answers  


Categories