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.

05 Mar 2024
Answer :
Word Count : 1135

In programming languages like C and Python, pointers and arrays have a closely intertwined relationship. While Python handles arrays differently than C, it’s important to understand how the concept of pointers works in C and how it relates to arrays.

### Relation between Pointers and Arrays in C:

In C, arrays and pointers are closely related. An array is essentially a block of contiguous memory locations, and a pointer is a variable that stores the address of another variable, including the address of the first element of an array.

When we declare an array in C, for example:

```c
int arr[5] = {1, 2, 3, 4, 5};
```

Here, `arr` is not just an array but also acts like a pointer to the first element of the array. In fact, the name of the array `arr` is equivalent to a pointer to the first element of the array. This means that the expression `arr` is pointing to the first element of the array `arr[0]`.

In C, we can use pointers to access elements of the array. For example:

```c
int *ptr = arr;  // Pointer ptr now holds the address of arr[0]
printf("%d\n", *ptr);  // Prints the value at the address pointed to by ptr (arr[0])
```

We can also use pointer arithmetic to traverse through the array. The following code demonstrates __________ __________ __________ _______ __________ _________ ________.
_________ ____ ___ _______ _________ _______ ___ ______ ________ _______.
_______ ______ __________ ____ ____ ___ ____ __________ __________ _________ ______.
___ ________ ____ ___ ___ _____ ____ _____ _______ _________ _______.
____ __________ ______ ____ ___ ____ ____ _____ _____ __________.
___ _____ _______ _________ ________ ________ __________.
_____ ____ ___ _______ ________ ________ _____ _______ _________.
____ ____ ___ __________ ____ ________ __________ _____.
_________ ___ _________ _______ ________ _____ ____ _________ ___ _____.
________ ______ ______ ____ __________ _________.
____ _______ ___ _________ ______ ____ ________ ______.
___ ________ ___ ________ ______ __________ _______ ______ ________ __________.
_____ __________ _________ ______ ________ ________.
_____ ____ ____ _______ ______ _____ _________ ____ _____ ______ ________.
_________ _____ _________ ________ ______ ________ ________ _____ ________ _________ _______.
____ __________ ___ ____ ___ ____.
_________ ____ __________ ________ ______ ___ __________ _____ _______ _____.
_________ ________ ____ __________ _________ ________ _________ ________ ________ _________ ________ _______.
___ _____ ____ ______ _________ __________.
________ ___ _________ ____ __________ ___ _______ ______.
_____ __________ __________ ________ ________ ___ __________ ____ ___.
_______ ______ ______ ________ ________ _______ _________ ________.
________ ____ ____ ___ ______ ___ ________ ______ ___ ________ _______.
________ _______ __________ ___ ____ _____.
___ ______ _______ _____ ___ __________ ___.
__________ _______ __________ ____ _______.
______ ____ _____ ___ _____ ______ _____.
________ ______ __________ __________ _______ ___ ______ _____ __________ ____ ______ __________.
______ ________ _____ __________ ____ ________ ___ __________ _____ ________ ________.
___ ________ ________ _________ ____ ___ ______.
__________ ________ __________ ___ _______ ________ ______ _____ _________.
_____ _________ ___ _________ _____ ______ _________ ___.
_______ _________ _________ _____ ________ ____ _______ ________ ______ _________.
___ ______ _______ ______ ________ ____ ________ ___ _______ ___ _________.
________ _________ ________ ___ ___ _________ ______ ____ ________ ____.
____ _________ ________ __________ _______ __________ _______ _____ ___ ____ _______ _____.
____ ___ ____ ___ _______ _________.
_______ ________ _____ ___ __________ ________ __________ ___.
___ _______ ______ ____ ________ _______ _____ _________ ________ ____.
______ ________ ______ ____ _________ ____ _______ _________ _________ __________.
______ _________ _____ _________ ___ ________ ________ ________.
__________ _______ ________ ______ __________ __________ _________.
______ ________ ______ ___ _________ ________ __________ ________ ___ ________ ____ ___.
________ ______ ____ _______ _____ _______ _______ ____ ____.
______ ________ _______ _______ _______ ____.
____ __________ ____ _______ _______ _________ ________ _____ _______ ________ ________ ____.
_______ ______ _______ __________ __________ ________ _______ _______ ________ ____ ________.
____ __________ ___ ____ ________ ________ __________ _____ ________ __________ _____ __________.
____ ________ _____ ________ ____ ___ _____ _________ ____.
______ ________ ____ _________ _________ _____ ________ _______ _______ __________.
__________ __________ ______ ______ _____ __________ ___ _____ ______ ______ ____ _____.
_______ ___ ________ __________ ___ __________ ______ _____ __________ ______ __________ ____.
_________ ______ _________ ____ ________ _____ __________ _________.
__________ ___ ________ _______ ____ __________ _________ ____.
_________ __________ __________ ________ ____ __________ _________ _________.
__________ _____ _____ _______ _______ _______ ____ ______ _________ ______.
______ _______ ___ _______ ________ __________ __________ ___.
________ _______ ____ ________ _______ ___ __________ ___.
_________ ___ ____ _________ _________.
________ _____ ___ ______ ________.
________ ________ ____ _________ _________.
________ ______ _______ ______ ______ ________ ______ _____ ______ _______ _______ ________.
______ _____ ____ ________ ______ _________ _______ ___ _____ ____ ____.
_____ __________ _________ ________ _____ __________ ______.
____ ____ _________ ______ _______ _____ _______ ________ ________ ___.
_________ ______ _________ _________ _____ __________ ______ _______ _______ ________ ___ ______.
___ _________ __________ ____ _____ _________ _______ ______ ______.
_______ ____ ____ ___ _____ _____ _________ ___ _______ _________ __________ ___.
______ ________ ________ _________ __________ ________ ___ ____.
_____ __________ ____ ____ _______ ____.
______ __________ ______ __________ _________ ___.
____ _________ ____ ___ _________ ______ _____ _________ ______ _________ ______ ___.
______ __________ ___ ______ _______ ______ _____ ________ ______ __________.
_______ _________ ____ __________ ________ ____ ____ __________.
_______ __________ ___ ________ ____ ________ _________ ____.
______ _________ ______ ____ _______ ___ ___.
____ _____ ____ ________ ____.
______ _____ ________ _____ ____.
_________ __________ _____ ___ ____.
___ ____ __________ _________ _______ ___ _________ ________ ________ ___ ____ __________.
______ ________ ______ ________ ____.
________ _____ ___ _____ ________ _____ ____.
_________ _____ _________ _______ ___ __________ ______ _______ ________ ________ _________.
______ ___ ______ ________ ________ ___ _____ _______ __________ __________ ____ _____.
________ _____ _________ ____ ____ ______ ___ ____ _________.
________ ________ __________ _________ _______ ______.
__________ ________ ____ ______ ___ _______ ______ _______ ____ _______ _______ _______.
__________ _________ _________ ______ ________ ___ ____ _________.
___ ________ ___ ________ _________ _____ __________ _________ _________ ____ ____.
______ _____ _____ __________ ____ ___ _________ ___.
________ _________ _______ ______ ____ __________ ______.
____ ______ ___ ___ ________.
___ __________ ___ ______ ________ ________ ___ _______ __________ ______ ____ ______.
____ _____ _______ ___ _________ _______ ________.
_______ _______ _______ _____ _____ ______.
_______ ___ __________ ___ _______ _________ _________.
______ ___ _________ ______ _________ ________ __________.
________ ___ ____ ______ ____ _________ ___ ___.
_______ _________ _________ _________ ________ _______ ________ ___ ________ ___ _______.
____ _____ __________ _______ __________ _____ ____.
________ _________ ____ _____ ________ _____ ____ __________ _______ _________ ___ ___.
_______ _________ ___ ____ __________ ______ _____ ________ _____.
_______ _________ _________ _____ ____ ___ ____ _________.
___ __________ _______ _____ _____ _____ ____ ______.
__________.
Get Full Answer on WhatsApp

IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Briefly discuss the relation between pointers and arrays, giving suita
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→