0% found this document useful (0 votes)
34 views

Assignment # 6 Arrays

The document discusses arrays and matrices. It asks the reader to: 1) Determine the memory location of an element in a 2D array stored in row-major and column-major order. 2) Write a function that sets the upper half of a 2D array passed to it to zero. 3) Implement sorting and merging techniques on arrays. 4) Write a program to add, subtract, and perform other operations on matrices.

Uploaded by

aruna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Assignment # 6 Arrays

The document discusses arrays and matrices. It asks the reader to: 1) Determine the memory location of an element in a 2D array stored in row-major and column-major order. 2) Write a function that sets the upper half of a 2D array passed to it to zero. 3) Implement sorting and merging techniques on arrays. 4) Write a program to add, subtract, and perform other operations on matrices.

Uploaded by

aruna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment # 6

Arrays

1. An array A[10][20] is stored in memory with each element requiring 2 bytes of storage. If the
base address of array in the memory is 400 , determine the location of A[5][10] when array is
stored in
(a) Row Major order
(b) Column Major order
2. Write a user defined function named New() which takes a two dimensional array as an
argument and the output shows all zeroes in the upper half.
For eg if the array entered is

6 3 2 1 8
9 4 7 9 3
A= 5 7 0 5 3
6 9 3 2 1
7 5 4 3 9

The output will be -----

0 0 0 0 0
9 0 0 0 0
5 7 0 0 0
6 9 3 0 0
7 5 4 3 0

PROGRAMS
3. Do all sorting and merging techniques as given in the book
4. WAP to :
(i) add two matrices
(ii) subtract two matrices
(iii) Display the row sum and column sum of the matrices
(iv) Display the transpose of a matrix
(v) Display the diagonal elements of a matrix

You might also like