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

main() { int a; a=++100; printf("%d",a); getch(); }

4 Answers  


Describe the steps to insert data into a singly linked list.

0 Answers  


What is an expression?

0 Answers  


What is the difference between a function and a method in c?

0 Answers  


pick out the odd one out of the following a.malloc() b.calloc() c.free() d.realloc()

2 Answers   TCS, ZenQ,






Which of the following about automatic variables within a function is correct ? a.its type must be declared before using the variable b.they are local c.they are not initialised to zero d.they are global.

6 Answers   FCI, TCS,


Explain how can you determine the size of an allocated portion of memory?

0 Answers  


Find greatest number out of 10 number without using loop.

5 Answers   TCS,


How is a macro different from a function?

0 Answers   Tech Mahindra,


What header files do I need in order to define the standard library functions I use?

0 Answers  


Did c have any year 2000 problems?

0 Answers  


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

0 Answers  


Categories