struct structure_name{ datatype member1; datatype member2; ........................... .......................... datatype membern; };
struct account{ int acc_no; int acc_type; char name[20]; float avail_bal; };
struct structurename var1,var2....varn;
struct account ac1; //when structure variables are declared,memory is allocated to them.
structurevariable.membername
#include<stdio.h> struct account { int acc_no; int acc_type; char name[20]; float avail_bal; }; main(){ account acc; printf("enter the account number:"); scanf("%d",&acc.acc_no); printf("Enter the account type:"); scanf("%d",&acc.acc_type); printf("enter the account name:"); scanf("%s",&acc.name); printf("enter the available balance:"); scanf("%d",&acc.avail_bal); printf("The account number is %d",acc.acc_no); printf("The account type is %d",acc.acc_type); printf("The account name is %s",acc.acc_name); printf("The available balance is %d",acc.avail_bal); }
0 1 2 3 4 6 7 8 9
structurename var={values};
account acc={10,114,"rajiv",7000};