📅  最后修改于: 2020-10-14 06:56:39             🧑  作者: Mango
结构是一种复合数据类型,它定义了一组变量列表,这些变量列表将以一个名称放置在内存块中。它允许使用指向结构的单个指针来访问不同的变量。
句法
struct structure_name
{
data_type member1;
data_type member2;
.
.
data_type memeber;
};
程序
#include
#include
void main( )
{
struct employee
{
int id ;
float salary ;
int mobile ;
} ;
struct employee e1,e2,e3 ;
clrscr();
printf ("\nEnter ids, salary & mobile no. of 3 employee\n"
scanf ("%d %f %d", &e1.id, &e1.salary, &e1.mobile);
scanf ("%d%f %d", &e2.id, &e2.salary, &e2.mobile);
scanf ("%d %f %d", &e3.id, &e3.salary, &e3.mobile);
printf ("\n Entered Result ");
printf ("\n%d %f %d", e1.id, e1.salary, e1.mobile);
printf ("\n%d%f %d", e2.id, e2.salary, e2.mobile);
printf ("\n%d %f %d", e3.id, e3.salary, e3.mobile);
getch();
}