in this program, we will learn how to declare a structure with different types of variables, declare and initialization of structure variable? Here we are not reading values from keyboard; we are assigning the values to the structure members at the time of structure variable declaration.
#include <stdio.h>
/*structure declaration*/
struct employee{
char name[30];
int empId;
float salary;
};
int main()
{
/*declare and initialization of structure variable*/
struct employee emp={"Mike",1120,76909.00f};
printf("\n Name: %s" ,emp.name);
printf("\n Id: %d" ,emp.empId);
printf("\n Salary: %f\n",emp.salary);
return 0;
}
in this program, we will learn how to declare a structure with different types of variables, declare and initialization of structure variable? Here we are not reading values from keyboard; we are assigning the values to the structure members at the time of structure variable declaration.
Output
need an explanation for this answer? contact us directly to get an explanation for this answer