0% found this document useful (0 votes)
4 views1 page

POINTER

The document outlines a series of programming tasks in C related to matrix operations, string manipulation, and pointer usage. It includes functions for matrix addition, checking matrix properties (upper-triangular, lower-triangular, diagonal, identity), matrix multiplication, finding transposes, counting words in a string, and extracting substrings. Each task requires the implementation of a main function to read inputs, call the respective functions, and display the results.

Uploaded by

s36347032
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)
4 views1 page

POINTER

The document outlines a series of programming tasks in C related to matrix operations, string manipulation, and pointer usage. It includes functions for matrix addition, checking matrix properties (upper-triangular, lower-triangular, diagonal, identity), matrix multiplication, finding transposes, counting words in a string, and extracting substrings. Each task requires the implementation of a main function to read inputs, call the respective functions, and display the results.

Uploaded by

s36347032
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

For each of the program stated below, also write a main function that reads the matrices, calls

the
function, and prints the results (a message, the result matrix etc.)

1. Write a C function to add two matrix using pointers.

2. Write a function that takes an n x n square matrix A as parameter (n < 100) and returns 1 if A is
an upper-triangular matrix, 0 otherwise.

3. Repeat 1 to check for lower-triangular matrix, diagonal matrix, identity matrix.

4. Consider a n x n matrix containing only 0 or 1. Write a function that takes such a matrix and
returns 1 if the number of 1’s in each row are the same and the number of 1’s in each column are the
same; it returns 0 otherwise.

5. Write a function that reads in an m x n matrix A and an n x p matrix B, and returns the product of
A and B in another matrix C. Pass appropriate parameters.

6. Write a function to find the transpose of a non-square matrix A in a matrix B.

7. Repeat the last exercise when the transpose of A is computed in A itself. Use no additional 2-d
arrays.

8. Write a function in C to count the total number of words in a string.


Test Data :
Input the string : This is CSS51 Lab
Output : Total number of words in the string is : 4
9. Write a function in C to extract a substring from a given string.

Test Data :
Input the string : this is test string
Input the position to start extraction :9
Input the length of substring :4

Output: The substring retrieve from the string is : test

10. Write a C program to input and print array elements using pointer.

You might also like