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. Also give comments.
In both C and Python, pointers and arrays have an intricate relationship. Arrays can be thought of as a sequence of elements of the same data type stored in contiguous memory locations, while pointers hold memory addresses as their values. In C, arrays and pointers often get intertwined due to the way arrays are internally represented. When you declare an array, it effectively represents a pointer to the first element of that array.
Let's delve into this relationship using an example and then create a C program to print the transpose of a 2D matrix entered by the user.
Consider an array in C:
```c
int arr[5] _________ ______ _____ ___ ___ ____ ______ ______ ____.
_____ ___ _____ ______ _______ ________ ___ __________ _____.
_________ ___ ________ __________ _____.
_____ ___ ___ ___ ____ ___ ____ __________.
__________ _____ ________ _______ ___ __________ _________ __________ ________.
_______ _______ ____ ______ ______.
______ _____ _____ ________ _____.
______ _________ ________ _________ ________ _____ ___ ________ _____ _____.
____ ___ ________ __________ _______ ___ _______ ___.
______ ______ ______ ___ __________.
________ ________ ________ _______ ________.
__________ _________ _________ __________ ___ ___ __________ __________ _________.
___ __________ ____ ______ ____.
_________ _______ _________ _________ __________ __________ ________ _____ _______ _____ _________.
_________ __________ ____ _______ __________ _________ _____ ___.
_________ ___ ______ _________ _______ ___ ____ ________ ____ ________.
__________ _________ _______ _____ ________ ________ _______ _______ _____ _____ __________.
______ ________ _______ _________ _____ _______ ______ _______ _____ _______.
_______ ___ _______ __________ _______.
_______ ____ ________ _____ ________ _______ ______ ___ _____ _______ ___ _____.
__________ ________ ______ _______ ______.
______ _______ _______ __________ _______ _____.
________ ______ ___ ____ ____ ___ ___ ____.
______ _____ ______ __________ __________ ___ __________.
________ _______ _____ ___ _______ _________ ___ _________ _______.
___ ________ ______ ________ ______ _______ _______ _______ ____ __________.
_______ _____ _____ _____ ____ ____ __________ ____ ___ __________ ____.
______ ___ ___ ______ ___ _____ ______ ___ __________ __________ ____ _____.
_________ ________ ________ ___ __________ __________ _______ ________ ________ _____ ___ ______.
____ ______ __________ _______ ________ ___ __________ _______.
____ ___ ___ ________ ________ ______ ________ _________ __________.
__________ _______ _____ ____ _____ ________ _______ _________ _________ ___ __________ ___.
____ _______ _____ ____ ______ ________ _______ ___ _________ __________ ______ _________.
______ ___ ________ _________ __________ ______ ____.
___ _______ _____ ______ _______ _________ _____ _______ ______ _____ ___.
_______ _____ _____ _______ ________ ____ ____ _________ __________.
______ ___ _____ ________ __________ __________ ______ ___ _________ ___ _________.
_______ _______ __________ ___ _____ ________ ______ ____ _________.
_________ _________ ______ ____ ___ ________ __________ _______ ______.
___ ____ ______ ____ ___ ________ ____ ___ ______ ___.
____ __________ ________ ________ ________ _____ _____ ________ ____ _______.
____ __________ _________ _________ _________.
_____ _________ ______ ___ _________ _____ __________ ___ ______ _____ _________.
_______ __________ _____ ________ ______ ______ _______ ___ _________ __________ ___.
_______ _____ __________ __________ ________ ________ __________.
______ _____ __________ ________ _______ _________ ____.
___ ______ _________ _________ _________ __________ ___ _____ _________ ___.
________ ______ ____ ___ __________ ____ ______ __________ _______ _______.
_______ ______ _______ __________ ______ _______ ________ __________ ______ _________.
_____ ___ _____ ___ ______ ________.
______ _____ __________ _______ ____ ________ ______ _____ _________.
______ __________ ________ _______ ___ ____.
____ ________ _________ _______ ___ _____ ________ __________ ____ ___ _____ __________.
________ ____ ___ ________ ________ ______ ____ __________ __________.
__________ _______ _______ __________ ___ _________ _____ _____ _______.
___ __________ ___ _____ __________ ________ _______ ______ __________.
______ ____ __________ _________ ____ ______ ______ ________ ____.
________ ________ _________ ____ _______ ________.
______ ________ ___ ______ _____ _________ _____ ________ __________ _______ __________ ____.
_______ ____ ______ ________ ____ _____ ________ _____.
________ ____ ___ _______ ______ __________ _______.
______ ________ _________ __________ __________.
_____ ________ _________ ___ _________ _______ __________ ____.
____.
Get Full Answer on WhatsApp