Question

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.

30 Nov 2023
Answer :
Word Count : 651

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] = {1, 2, 3, 4, 5};
```

In memory, this array looks like:  
| 1 | 2 | 3 | 4 | 5 |

Here, `arr` is a pointer to the first element `arr[0]` in the array. Incrementing `arr` moves it to the next element in the array (`arr + 1` would point to `arr[1]`). This relationship between arrays and pointers forms the foundation for array manipulation in C.

Now, let's create a C program that prints the

_______ ____ __________ ____ _____ _____ _______ _____ __________ ________ _____ ___.
_________ __________ _________ ____ _______ ___ ___.
_______ _____ ____ ___ ______ ____ _________ _________ ________ _________ ______.
__________ ___ _____ _______ _______ ____ _____ _____ ___ _______.
_________ ________ _______ ____ _________ __________ ________ ___ _______ __________ __________.
______ ______ _________ ______ ______ _____ _________ __________ ___ __________ __________.
___ ____ ________ _________ ________ ___ ________ ____ _____ _________ ______.
________ _________ _______ _____ ____ __________ __________ __________ _____ ____ _______ __________.
_____ _________ ______ ________ ___ ___ __________ _______ _____.
__________ ________ __________ _______ ____ _________ _________ _______ ______ _________.
______ ____ ________ __________ __________ ______ ________ _________ ____ ____.
__________ ____ _________ __________ ______ ___ ____ ______ _________.
__________ _________ _____ ____ ________ __________ _______.
_____ ________ __________ ___ _____ _____ _________ __________ _________ _________.
__________ _____ ____ _______ ________ __________ ____ ________ ___ _____ ____ __________.
______ ______ _________ _________ _____ _________ __________ __________ ___ __________ ______.
_____ _________ ____ _________ _______.
___ _________ ______ _____ ________ ________ _________ _____ ______ ____ ________ _________.
_______ ___ ______ ______ _____ _________ ___ __________ ___ ____ _________.
________ ___ ___ ____ _______ ________ ___ __________ ________ ______ ____ _______.
____ ________ ___ _____ ________ _________ _________ _______ ______ _______ ___ _________.
_______ ________ _____ ______ ___ ___ _______.
____ _______ ______ _________ __________ _________ _____ _____ ___ ______.
_______ _____ ______ __________ ______ ____ ________ ___ ____ ______.
_______ __________ _______ ________ _______ ______ __________ ______ _________ ________ __________.
___ ____ __________ _________ _____.
________ ______ ___ _______ __________.
____ _________ ________ _____ ________ ________ _______ ___ ______ ____.
_____ _________ ___ __________ ______ ______ ___ ____ ___ ______.
_____ __________ __________ _____ ___ __________ ___ ________ _____ ______ _________ ___.
________ ____ __________ _________ ____ ________ ________ ________ _____ __________ __________.
_____ ____ _____ _________ ____ ___ _________ ______.
_____ _______ __________ __________ _____ _______ ____ ___.
_______ __________ ___ ________ ________.
______ ______ _____ ______ _____ ___ ________ _________ _______ _______.
_________ _____ _______ _______ ______ ____ _______ _____ ______.
______ __________ ________ _________ ________ ______ __________ __________ ___ ____ _______ ________.
__________ ________ __________ ________ _____ _______ ________.
_______ _________ __________ _______ ________ _________ ____ __________ ______.
_______ ___ ________ _________ _____ __________ _____ ____ _____.
___ _____ ________ __________ ____ _____.
____ __________ _______ ___ _____ ____ _________.
________ _______ __________ _________ _______ ___.
____ ________ ____ ______ ______ _________ ___.
___ _______ _______ ________ __________ ___ _________ ____.
______ ________ _____ ________ ___ ___ __________.
_________ _______ _____ ___ ________ ________.
___ ___ _____ ______ ________ _____ ________ ___ ___ _______.
________ _______ ________ ____ ______.
____ ___ _________ _______ ________ ________.
__________ __________ __________ _____ ___.
_____ _______ ____ __________ ________ __________.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCS 201 2023 - Briefly discuss the relation between pointers and arrays, giving suita | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→