Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Motilal Nehru National Institute of Technology, Allahabad

Computer Science & Engineering Department


Even Semester 2017-18

C Programming Lab (Assignment 6)

1. Write a C program to sort an array using Pointer.


2. Define a structure type, struct personal that would contain person name, date of joining and
salary. Using this structure, write a program to read this information for one person from keyboard
and print the same on the screen.
3. Create two structure named metric and british which store the values of distances. The metric
structure stores the values in metres and centimetres and the british structure stores the values in
feet and inches. Write a program that reads values for the structure variables and adds values
contained in one variable of metric to the contents of another variable of british. The program
should display the result in the format of feet and inches or metres and centimetres as required.
4. Write a C program to illustrate the method of sending an entire structure as a parameter to a
function named “total_sum()”:
Create a structure named marks having five structure members for different subject marks, then
send the entire structure from main() to function “total_sum()” and in this function find the total
subjects mark.
5. Write a C program to store ‘n’ elements in a block of memory space created by malloc and then
modify the same to store ‘2n’ elements.
6. Write a C program to input and print text using Dynamic Memory Allocation.[ create memory for
text string at run time using malloc() function, text string will be inputted by the user and
displayed. Using free() function release the occupied memory.]
7. Write a program in C to find the largest element of ‘n’ elements using Dynamic Memory
Allocation.
8. Write a C program to read a one dimensional array, print sum of all elements along with inputted
array elements using Dynamic Memory Allocation.
9. Write a C program to read and print the student details using structure and Dynamic Memory
Allocation.
10. Write a program in C to take a matrix in function named ‘func()’, then return entire matrix in
‘main()’ and in main() find & display the sum of all matrix element.

You might also like