Lab_Assignment-10
Lab_Assignment-10
1. Consider 2 sets of integers, A and B, are stored in arrays. Write a program to find the
number of (possibly overlapping) occurrences of the sequence B in A.
2. Write a program to concatenate two strings. Find whether the concatenated result is a
palindrome or not. Access the strings with pointers only.
3. Dynamically allocate memories to store a pair of matrices received from the user.
Perform multiplication of these matrices. Use malloc() for dynamic allocation of
memory and the function free() for deallocation.
4. Dynamically allocate memories to two square matrices A and B. Check if the following
holds true: (A.B)-1 = B-1.A-1 .
Use malloc() for dynamic allocation of memory and the function free() for deallocation.
5. Write a program that uses an array of pointers. Elements of the array point to strings.
Now reorder the pointers so that they point to the strings in sorted order.
6. Write a function that uses binary search algorithm to search an array of strings.
7. Write a program that uses an array of pointers to strings str[]. Receive two strings str1
and str2 and check if str1 is embedded in any of the strings in str[]. If str1 is found, then
replace it with str2.
char *str[]={
“We will teach you how to…”,
“Move a mountain”,
“Level a building”,
“Erase the past”,
“Make a million”,
“…all through C!”
};
For example, if str1 contains ‘mountain’ and str2 contains ‘car’, then the second string
in str should get changed to “Move a car”.
8. Write a program that takes a set of names of individuals and abbreviates the first, middle
and other names except the last name by their first letter.
9. Write a program to create an array of pointers to string where the strings are entered
through keyboard. Now sort the pointers to point to strings in alphabetical order. Use
malloc() for dynamic allocation of memory and the function free() for deallocation.