How would you differentiate between the terms pointer to an array and array of pointers? Give proper examples.
The terms "pointer to an array" and "array of pointers" refer to different concepts in C programming, distinguished by how they are declared and used.
1. **Pointer to an Array**:
- A pointer to an array is a pointer variable that points to the first element of an array.
- When you have a pointer to an array, you can access elements of the array using pointer arithmetic.
- The pointer to an array points to the memory address where the array is stored.
- Example:
#include <stdio.h>
int main() {
___ __________ _______ _____ ____ _______ ___.
______ ________ ______ ________ _________.
__________ _______ _______ _____ _________ _______.
_____ _____ _________ _____ ________ _______ ______ _______ _________.
_________ ________ _____ _____ ______.
_____ _________ ___ ____ _____ __________ _________ ______ _____ _____.
_____ ____ ______ _______ ________ ____.
_______ _________ ________ ________ ________ _______ ___ _________ ________ __________ _______ ________.
_________ ______ _________ ______ _________ _____ __________ _____ ____ ____ ___.
___ ________ ___ _______ _________ __________ ____ ________ __________ _______.
________ _________ __________ _______ __________ __________ _______ ____ _______ ___ __________.
___ __________ _______ ______ __________.
_________ _______ _________ _____ ___ ______ ______ ______.
___ _____ __________ _______ _______ _______ ____ ___.
___ _________ __________ _________ _______ _____ ___ ________ ________ __________ _____ ________.
___ ___ __________ ____ ______ _______.
____ _________ _____ ____ __________ ______ ______ ___.
__________ _______ _______ ____ _____ _____ ________ ___.
_______ ___ ___ ___ _____ ____ ______ _________ _________ _________ ____.
________ ___ _____ _______ ________ ___ ________.
_________ _________ ___ ____ _______ _________ __________.
____ ________ ______ __________ ___ ________ ________ ____.
_______ _______ _________ _______ ______ ___ __________ _________ ____.
________ ___ ______ _____ ___ _____ ______ _______.
__________ _______ ____ _________ _____ ______ ____ _____.
__________ _____ ______ __________ ________ __________ _____.
__________ _______ __________ _____ _____ ________ ________.
________ ______ ______ ___ _________ ____ ________ _________ ______ _____.
________ ______ _________ _____ ________ ___ _____ _________ ______ ___.
_____ _________ _________ ____ ________ ___ _______ ________ ____ _________ ________.
______ ______ ______ _______ _______ _______ _____.
__________ _________ __________ ___ ______ _____ _______ _________.
_____ _______ _______ ___ _______ ________ _________ __________ ______.
______ _____ _________ __________ ________.
______ _____ __________ _______ __________ ___ _______ ________ __________ _______.
__________ __________ ___ _________ __________ _________ ______ ___ ____ _______.
___ _____ ______ ___ _________ __________ _______ _________.
____ _____ ___ ____ ________.
______ _______ _______ ______ ___ _________ _________ _________ ____ _______ ___ __________.
________ __________ _______ ________.
Get Full Answer on WhatsApp