Pointers
One reason is you want to change the value of the pointer passed to a function as the function argument, to do this you require pointer to a pointer Use __ when you want to preserve (OR retain change in) the Memory-Allocation or Assignment even outside of a function call.
**
Therefore, you can perform arithmetic operations on a pointer just as you can on a numeric value. There are four arithmetic operators that can be used on pointers: __,__,_, and _
++, --, +, and -
In most of the operating systems, programs are not permitted to access memory at address ___ because that memory is reserved by the ___ ___.
0 operating system
Normally, a pointer contains the ___ of a variable.
address
When we define a pointer to a pointer, the first pointer contains the ___ of the second pointer, which points to the location that contains the actual value as shown below. pointer address>pointer address>variable value
address
A pointer in C is an ___, which is a ___ value.
address numeric
A variable that is a pointer to a pointer must be declared as such. This is done by placing an additional ____ in front of its name. what does it look like for a type int? When a target value is indirectly pointed to by a pointer to a pointer, accessing that value requires that the asterisk operator be applied twice.
asterisk int **var;
pointer to a character
char *ch
The NULL pointer is a ___ with a value of ___ defined in several standard libraries.
constant zero
The only difference between pointers of different data types is the ___ ___ of the variable or ___ that the pointer points to.
data type constant
Like any variable or constant, you must ____ a pointer before using it to store any variable address.
declare
The same considerations apply to ___ a pointer, which decreases its value by the number of bytes of its data type
decrementing
pointer to an integer
int *ip;
There may be a situation when we want to maintain an array, which can store pointers to an int or char or any other data type available. Following is the declaration of an array of pointers to an integer what does the code look like? It declares ptr as an array of MAX integer pointers. Thus, each element in ptr, holds a pointer to an int value. A common use of an array of pointers is to store a list of ____, which are character arrays
int *ptr[MAX]; strings
The actual data type of the value of all pointers, whether integer, float, character, or otherwise, is the same, a ___ ___ number that represents a memory address.
long hexadecimal
As you know, every variable is a ___ ___ and every ___ ___ has its ___ ___ which can be accessed using ___ operator, which denotes an address in memory.
memory location memory location address defined ampersand (&)
A pointer to a pointer is a form of ___ ___, or a chain of ___.
multiple indirection pointers
But by convention, if a pointer contains the null (zero) value, it is assumed to point to ___.
nothing
A pointer that is assigned NULL is called a ___ pointer.
null
However, the memory address 0 has special significance; it signals that the _______________.
pointer is not intended to point to an accessible memory location.
Pointers may be compared by using relational operators, such as ___, ___, and ___. If p1 and p2 point to variables that are related to each other, such as elements of the same array, then p1 and p2 can be meaningfully compared.
==, <, and >.
It is always a good practice to assign a ___ value to a pointer variable in case you do not have an exact address to be assigned. This is done at the time of ___ ___.
NULL variable declaration
pointer to a double
double *dp;
Some C programming tasks are performed more easily with pointers, and other tasks, such as ___ ___ ___, cannot be performed without using pointers.
dynamic memory allocation
pointer to a float
float *fp;
C programming allows passing a pointer to a ___. To do so, simply declare the function parameter as a ___ ___. The function, which can accept a pointer, can also accept an ___ .
function pointer type array
Developers may prefer using a pointer in their programs instead of an array because: the variable pointer can be ___. unlike the ___ name which cannot be incremented because it is a constant pointer
incremented array
Return pointer from functions We have seen how C programming allows to return an array from a function. Similarly, C also allows to return a pointer from a function. Second point to remember is that, it is not a good idea to return the address of a local variable outside the function, so you would have to define the local variable as ___ variable.
static
___ is the pointer's base type; it must be a valid C data type
type
The general form of a pointer variable declaration what does the code look like? However, in this statement the asterisk is being used to designate a variable as a pointer
type *var-name;
____ is the name of the pointer variable. The asterisk * used to declare a pointer is the same asterisk used for multiplication.
var-name
A pointer is a ___ whose value is the address of ___ ___, i.e., direct address of the memory location.
variable another variable