Usual variable used so called value type mechanism, meaning that if you have passed the variable to a function the variable itself was not passed, only its copy. Which makes value type mechanism safe. The only problem is that you use a lot of memory because a copy of your variable has been created.
Pointers allow to avoid creating copies and operate with addresses of variables. It means when you pass your variable to any function, you actually pass only the variable's address. This mechanism is called reference type.
Pointers work much faster and allow to use memory more effectively. The only problem is you have to take extra care when you are working with pointers. Using pointers any area of memory including protected by OS can be accessed. Such event will cause "blue screen" (under windows).
Pointers store the addresses of other variables (primitive data-types, user-defined data-types (like structures and classes), as well as other pointers (in the case of a pointer to a pointer)).
On the other hand, ordinary variables simply store data values.
A pointer must be dereferenced using the * operator to refer to its data value.
For example,
int a; // this is an ordinary variable
int *p = &a; // this is a pointer to the integer variable a
In the above example the & symbol is the address-of operator. It returns the address of variable a.
how pointers variables diffrent from ordinary variables
Pointer variables are perfectly normal variables.
The former is variable, the latter is constant.
yea that's why its called the point FINGER
Answergenerally we use simple pointer, void pointer,null pointer, structure pointer. Answerzero or more (unlimited).
In c a pointer is a variable that points to or references a memory location in which data is stored. Each memory cell in the computer has an address that can be used to access that location so a pointer variable points to a memory location we can access and change the contents of this memory location via the pointer. Pointer declaration A pointer is a variable that contains the memory location of another variable. The syntax is as shown below. You start by specifying the type of data stored in the location identified by the pointer. The asterisk tells the compiler that you are creating a pointer variable. Finally you give the name of the variable. type * variable name Example: int *ptr; float *string;
Pointer to Pointer is a double pointer, denoted by (**). Pointer stores the address of the variable and pointer to pointer stores the address of a pointer variable and syntax can be given as int **ptr2ptr;
pointer
Pointer-variables are variables, so there is no difference.
normal variable stores a value of the given datatype where as the pointer variable stores the address of a variable. for example int n=10; int *p; p=&n; here p is a pointer variable and n is a normal variable.p stores the address of n where as n stores an integer value. *p prints the value of n,p prints the address of n.
pointer is the variable that holds the address of another variable
Pointer is a variable, A variable that stores the address of another variable. Size of a pointer is 2 bytes.
Pointer is a variable that stores the address of another variable. Since pointer is also akind of variable, thus pointer itself will be stored at a different memory location.
Pointer is a variable that stores the address of another variable . So pointer basically stores the address of another variable and size of pointer can be evaluated by using sizeof operator.
with the help of pointers we able to store the memory location of any variable. In c the pointer variable is use to store the memory location of any variable. The pointer variable is define as a simple variable but in pointer variable use a special "*" character at the left most side of name of pointer variable. If any variable name have * it means it is a pointer variable it hold the memory location of variable.
pointer variable B holds base address of B
A pointer is used for pointing to a variable. It contains the address of the variable to which it points
A void pointer variable is a pointer variable (of some type) that is assigned the value zero, meaning it points to address zero. Memory address zero is a reserved address, which means the pointer variable references nothing in particular.
Double (**) is used to denote the double pointer. As we know the pointer stores the address of variable, Double pointer stores the address of any pointer variable. Declaration : int **ptr2Ptr;
yea that's why its called the point FINGER