what is pointer

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of sorting are there in c?

600


Which are low level languages?

619


What is operator precedence?

637


What are the 4 data types?

589


Differentiate between ordinary variable and pointer in c.

611






Tell me about low level programming languages.

633


What is a header file?

627


What are the types of type specifiers?

616


How do you generate random numbers in C?

643


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2027


Are the expressions * ptr ++ and ++ * ptr same?

659


What does it mean when a pointer is used in an if statement?

594


Explain what is the best way to comment out a section of code that contains comments?

709


How many keywords are there in c?

581


How can I automatically locate a programs configuration files in the same directory as the executable?

618