Skip to content

Instantly share code, notes, and snippets.

@Boggartfly
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Boggartfly/11266980 to your computer and use it in GitHub Desktop.
Save Boggartfly/11266980 to your computer and use it in GitHub Desktop.
Structures in C
#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();
}
@Boggartfly
Copy link
Author

Example program to use structures in C programming language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment