Write a program in Program Notebook......
For Exmaple: Write a program
to create structure as employee and accept idno, name of employee , city and
salary of employee and pass it to the user defined function by using call by
value
#include <stdio.h>
#include<conio.h>
struct employee
{
int idno;
char ename[20];
char city[10];
float salary;
};
void output(struct employee
ep);
void main()
{
struct employee e;
printf("\n Enter ID
number:");
scanf("%d",&e.idno);
printf("\n Enter name of
Employee: ");
scanf("%s",&e.ename);
printf("\n Enter City of
Employee:");
scanf("%s",&e.city);
printf("\n Enter Salary
of Employee");
scanf("%s",&e.salary);
output(e); // Calling function
(passing structure variable stud as argument)
getch();
}
void output(struct employee
eu) //Function definition
{
printf("\n Employee
Id is: %d",ep.idno);
printf("\n Name of
Employee is: : %s",ep.ename);
printf("\n City of
Employee is: %s",ep.city);
printf("\n Salary of
Employee is: %f",ep.salary);
}
Output:
Comments
Post a Comment