Last active
August 29, 2015 14:00
-
-
Save Boggartfly/11266980 to your computer and use it in GitHub Desktop.
Structures in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<studio.h> | |
#include<conio.h> | |
struct employee { | |
int emp_id; | |
float salary; | |
char sex; | |
}emp[100]; | |
void main() | |
{ | |
int i=0,n=0; | |
clrscr(); | |
printf("Enter number of employees"); | |
scanf("%d",&n); | |
printf("Enter details"); | |
for(i=0;i<n;i++) | |
{ | |
scanf("%d%f%c",&s[i].emp_id,&s[i].salary,&s[i].sex); | |
} | |
for(i=0;i<n;i++) | |
{ | |
printf("%d%f%c",s[i].emp_id,s[i].salary,s[i].sex); | |
} | |
getch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example program to use structures in C programming language.