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

Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

0 Answers  


What is const keyword in c?

0 Answers  


What is the difference b/w Structure & Union?

3 Answers  


write C code to reverse a string such that if i/p is "abc defg hij klmno pqrs tuv wxyz" and the o/p should be "cba gfed jih onmlk srqp vut zyxw"

2 Answers  


Which is best linux os?

0 Answers  






How can you convert integers to binary or hexadecimal?

0 Answers  


what is the defrenece between structure and union

5 Answers   Aloha Technology,


Why cd or dvd are round why not square.

1 Answers  


find second largest element in array w/o using sorting techniques? use onle one for loop.

15 Answers   BitWise, Zycus Infotech,


What is a constant?

0 Answers  


write a statement to display all the elements array M(in reverse order? int M[8]={20,21,22,23,24,25,26,27};

5 Answers  


What is use of bit field?

0 Answers  


Categories