31: We know that a[i] = *(a+i). What will a[i][j] be?
Solution 31:
a[i][j] will be internally converted to *(*(a+i) + j) by the C compiler.
Example
32: Give some applications of pointers.
Solution 32:
Applications:
1. To access array elements
2. For dynamic memory allocations
3. Use of pointer concept in call by reference
4. To implement linked lists, trees, graphs, etc.
Example
33: Define a null pointer.
Solution 33:
For any type of pointer, C defines a
null pointer
as a special type of pointer that is
guaranteed not to point to any object or function of that type.
Note that the null pointer constant
used for representing a null pointer is the integer 0.
Example
34: Define a null pointer, a NULL macro, the ASCII NULL character, and a null string.
Solution 34:
A null pointer is a pointer that doesn’t point anywhere.
A NULL macro is used to represent the null pointer in the source code. It has a value 0 associated
with it.
The ASCII NULL character has all its bits as 0 but doesn’t have any relationship with the null
pointer.
The null string is just another name for an empty string—“”.
Example
Do'stlaringiz bilan baham: |