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
National College of Engineering
Subject: C Programming Faculty: BCT+BEL Prepared By: Subash Panday Lab-9: Structure and Passing Structure to Function.
Objectives: To be familiar structure, array of structure and Nested structure.
Related Theory:
a. Structure and Declaration of Structure.
b. Accessing structure elements. c. Array of Structure. d. Passing structure member to function. e. Passing entire structure to function Lab Task: 1. Write a program to get and display the data of 3 employee using array of structure. 2. Create a structure called "time" with data member hour minute and second. WAP to add two times. 3. WAP to add two complex number using structure 4. Create structure student which contains roll, name and marks of three subject. WAP to display total marks and average marks of three subjects. 5. WAP to input name, roll, marks and address of n students from the user using structure and display entered information of students in the order of their marks. 6. WAP to input name, roll, marks and address of n students from the user using structure and display entered information of students in alphabetical order . 7. WAP to input name, roll, marks and address of n students from the user using structure and display only that record whose roll number is entered by the user. Passing Structure To Function. 1. Create a structure student having name, roll, marks, address and phone number. WAP to display the details of student using the concept of passing structure to function concept. 2. Create a structure student having name, roll, marks, address and phone number. WAP to display the details of n student using the concept of passing structure to function concept. 3. WAP to represent complex number by a structure with real and imaginary as members. Take 2 complex numbers from the user into structure variables. Pass the complex number to a function which calculates sum and return it. Display the sum from the another function display ( ). 4. Create an array of structure named employee with name and salary as structure member and the array of structure is passed to a function which sorts in ascending order on the basis of salary and display the sorted array from the main. 5. WAP to create a structure named Student that has name, roll, marks and remarks as its members. Assume appropriate date types and size of members. Use the structure to read and display records of four students. Create two functions: one is to read information of students and other is to display the information on screen. Pass an array of structure to above functions as their arguments.