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. 

13 Sep 2024
Answer :
Word Count : 1002

### Relation Between Pointers and Arrays in C and Python

#### C Programming

In C, arrays and pointers are closely related. Here’s how they interact:

1. Array Declaration and Memory Allocation:
   When you declare an array in C, you are allocating a block of memory to hold multiple values of the same type. For example:
   ```c
   int arr[5];
   ```
   This line allocates memory for 5 integers.

2. Pointer and Array Relationship:
   An array name in C acts as a pointer to the first element of the array. Thus, `arr` can be used as a pointer to the first element. This means that `arr` is essentially equivalent to `&arr[0]`. 

3. Pointer Arithmetic:
   You can use pointers to traverse and manipulate arrays. For example:
   ```c
   int *ptr = arr;  // 'ptr' points to the first element of 'arr'
   ```
   To access the second element, you can use:
   ```c
   *(ptr + 1)  // Equivalent to arr[1]
   ```

4. Function Arguments:
   Arrays are often passed to functions as pointers. When you pass `arr` to a function, you are actually passing a pointer to the first element of the array, not a copy of 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 2024 2025 - Briefly discuss the relation between pointers and arrays, giving suita | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→