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 |
int j =15,i; for (i=1; 1<5; ++i) {printf ("%d%d ",j,i); j = j-3; }
Which of the following is not a valid declaration for main ()? 1) int main() 2) int main(int argc, char *argv[]) 3) They both work
What is the use of structure padding in c?
Write a program in c to replace any vowel in a string with z?
how does the C compiler interpret the following two statements p=p+x; q=q+y; a. p=p+x; q=q+y b. p=p+xq=q+y c. p=p+xq; q=q+y d. p=p+x/q=q+y
can we declare a variable in different scopes with different data types? answer in detail
what is const volatile?
WAP – represent a char in binary format
write a program in c language for the multiplication of two matrices using pointers?
How do you initialize pointer variables?
find the size of structure without using the size of function
What is adt in c programming?