Another way to initialise structure
#include<stdio.h>
#include<string.h>
struct employee{
int code;
float salary;
char name[20];
};
int main(){
struct employee sunil= {100, 34.23, "sunil"};
printf("Code is: %d \n", sunil.code);
printf("Salary is: %f \n", sunil.salary);
printf("Name is: %s \n", sunil.name);
return 0;
}
Comments
Post a Comment