using typedef and function in structures
#include <stdio.h>
#include<string.h>
typedef struct employee
{
int code;
float salary;
char name[10];
}emp;
void show(emp emp1)
{
printf("Code of employee1 is:%d\n",emp1.code);
printf("Salary of employee1 is:%0.2f\n",emp1.salary);
printf("Name of employee1 is:%s",emp1.name);
}
int main(){
emp e1;
emp *ptr;
ptr=&e1;
ptr->code=101;
ptr->salary=134.34;
strcpy(ptr->name,"Anchal");
show(e1);
return 0;
}
Comments
Post a Comment