what is a pointer?

+6 votes
asked Dec 21, 2019 by kothakushal (560 points) 2 flags
reshown Dec 22, 2019 by kothakushal

14 Answers

+1 vote
answered Jan 7 by krishna
a pointer is a stores the address of another variable is called a pointer
0 votes
answered Jan 8 by anonymous
A pointer is store a address of variable (location)
0 votes
answered Jan 8 by All in one Technical Aaditya (360 points)
A pointer is store a address of variable (Location of variable)

The pointer is difficult to understand for beginner
0 votes
answered Jan 16 by anonymous

- Fundamentally, a pointer is a number. Very often, it is represented as a hexadecimal number.

- If the hexadecimal number is a valid memory location, then it is deemed to be a valid pointer. If not, it is a illegal pointer. Consider that a_var is a integer variable. The unary operator  gets the memory address of any variable that has been defined. Therefore, the  expression &a_var will evaluate to a valid pointer.

- A pointer variable is used to store a pointer value. 

  int *pointer_a = &var_a; 

In the above code, pointer_a is initialised with the memory address of  var_a variable. Proper attention must be taken to assign a valid pointer value to pointer variable. Otherwise, when the unary operator is used to de-reference a pointer variable, it may result in a program crash or illegal memory access.  

  int *pointer = 0; // not a valid memory location 
  printf ("%d", *pointer); // de-referencing an illegal pointer value may likely cause program crash 
 

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...