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

C Programming Lab.... Arrays and Pointers

This document provides instructions for a laboratory session on multi-dimensional arrays and pointers in C programming. It includes two programs to be compiled and executed: one that adds two matrices, and another that calculates the determinant of a 3x3 matrix. Students are also given an exercise to write a program that uses pointers to arrange five input names alphabetically.

Uploaded by

Oscar Bosha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

C Programming Lab.... Arrays and Pointers

This document provides instructions for a laboratory session on multi-dimensional arrays and pointers in C programming. It includes two programs to be compiled and executed: one that adds two matrices, and another that calculates the determinant of a 3x3 matrix. Students are also given an exercise to write a program that uses pointers to arrange five input names alphabetically.

Uploaded by

Oscar Bosha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

EEE121 LABORATORY MANUAL 7 MULTI-DIMENSIONAL ARRAYS AND POINTERS Multi-dimensional arrays are defined in a similar way to one-dimensional arrays,

except that a separate pair of square brackets is required for each subscript. We can use multidimensional arrays to perform operations on matrices. Pointers are variables which contain the addresses of data items i.e they point to the data item to be accessed. Pointers find extensive use in passing arguments to functions, as well as when working with ragged arrays. In this lab we will make use of multi-dimensional arrays and pointers in our programs. .

INSTRUCTIONS 1. There are 2 programs to be compiled and executed during this lab session. After each program you are required to show your supervisor the program output during the lab session. 2. The Exercises section of this lab manual contains a programming question for you to work on during the week. Submit these on or before the next lab session. (Save the program and give it to your class rep for submission). Save your program in the following format: <reg no_lab number> For example: H1025468V_lab7

Program 1 Adding two matrices Compile and run the following program:

Program 2 Write a program in C which finds the determinant of a 3x3 matrix. The user should input the matrix elements and the program should store them in a multi-dimensional array.

Exercise Using pointer notation, write a program in C which reads in five names from the user, and arranges them in alphabetical order.

You might also like