Briefly discuss the relation between Pointers and Arrays, giving suitable example. Write a program in C, to print transpose of a 2D matrix entered by a user. Support your program with suitable comments.
Pointers and arrays have a close relationship in C programming, as arrays can be accessed using pointers and vice versa. In C, an array name often behaves like a pointer to the first element of the array. When you use the array name, it gets converted into a pointer to the first element.
Consider the following example:
```c
#include <stdio.h>
int main() {
int arr[3] = {1, 2, 3};
int *ptr = arr; // ptr points to the ______ __________ _____ ____ _______ ______ _________ ______ __________ __________ ______ _______.
________ _______ ____ _________ ___ ___ ______ ____ _____ ______.
______ _____ ___ ____ ______ __________ ___.
_______ ___ ______ _______ __________ __________ ___ ______ _________ ______ _____ ___.
_____ ______ ______ __________ ___.
_________ ____ __________ ___ ___ __________ _________ ____ _____ ___ _________ ____.
_______ __________ ____ ___ _____ ______ _________ ______ _________ _______ ____ _________.
____ _____ _________ _______ _____ ________ __________ _______ _____ ____ __________ ___.
____ ____ _______ _______ ________ ___ ____ ______ ________ ____.
_______ __________ ___ _________ ____ _____.
_________ ________ _______ ________ _____ ___ _______ ____ _______ __________.
_________ __________ ________ ____ _______ ___ __________ ____ ___.
________ ________ __________ ____ ____ ______ _________ _______.
______ ________ ___ __________ ____.
______ ____ __________ ________ ___ _____ ______ _______ ______.
__________ _____ ____ _________ _________ _______.
____ _____ _____ __________ ___ ____ _________ ______ ____.
____ _______ ______ ____ __________.
____ ___ ________ ______ ________ _____ _________ _________ _________ _________ ______.
____ ______ _______ _____ _______ ______ _____ ______ _____ _______.
_________ ___ __________ _____ __________ _____ __________ _________ ____ _______.
__________ __________ _________ ________ _____ ________ ___ _________ _____ ________.
________ _____ __________ _____ ____ _______.
________ ________ _______ _____ _____ ________ ___ _______ _____ _______ _____ ________.
_______ _____ _________ ____ _______ ___ __________ _______ _________ _______.
____ ______ ___ _________ _____ ___ ________ _________ ______ _____.
______ ____ __________ ____ __________ ____.
__________ ________ ______ ________ __________ ________ ____ ______ _____ ____ ________.
____ __________ ___ ____ ______ ______ ____ __________.
___ ________ __________ __________ _______.
_______ _____ __________ _____ ______ _________.
____ _____ ______ __________ __________.
____ ______ ____ __________ ____.
_______ _______ _________ ___ _________.
________ _________ ___ _________ ________ ____ ______ _______.
__________ _______ _______ _______ ____ _____.
______ ___ ___ ______ ______ __________ ____ ______ ________ _____ _____ __________.
_________ ____ _______ _______ _____.
_______ _________ _____ _________ _______ _________ __________ ______ ________ ___ ___.
_____ ______ _____ ___ _________ ____ ___ ______ _______ ____ ______ ______.
_________.
Get Full Answer on WhatsApp