SlideShare uma empresa Scribd logo
1 de 7
//Program for array of a stucture
#include<stdio.h>
#include<conio.h>
void main()
{
struct employee
{
int id;
char n[20];
char des[30];
char dept[30];
float sal;
};
struct employee e[50];
int i,no;
clrscr();
printf("enter the no.of employees:n");
scanf("%d",&no);
printf("enter the details for %d personsn",no);
printf("emp_id,emp_name,emp_des,emp_dept &emp_salaryn");
for(i=0;i<no;i++)
{
scanf("%d%s%s",&e[i].id,&e[i].n,&e[i].des);
scanf("%s%f",&e[i].dept,&e[i].sal);
}
printf(""n************O/P**********n");
printf("nemp_idtemp_nametemp_destemp_dept temp_salaryn");
for(i=0;i<no;i++)
{
printf("%d%s%s",e[i].id,e[i].n,e[i].des);
printf("%s%f",e[i].dept,e[i].sal);
printf("n");
}

getch();
}
***************O/P***************************
emp_id emp_name         emp_des           emp_dept       emp_salary

1      hemant          s/w_developer      s/w._company   20000
2      sara            Lecturer           CSE            22000
3      charan          Lecturer            IT            25000
//Program for nested structure
#include<stdio.h>
#include<conio.h>
void main()
{
struct address
{
char land[30];
int strtno;
int hno;
char city[20];
};
struct date
{
int d;
int m;
int y;
};
struct person
{
int id;
char n[20];
int age;
struct date D;
struct address A;
};
struct person p;
int x;
clrscr();

printf("enter the details of the person:n");
printf("Id,name, agen");
scanf("%d%s%d",&p.id,&p.n,&p.age);
x=strupr(p.n);
//printf("%s",x);
printf("enter DOBn");
scanf("%d%d%d",&p.D.d,&p.D.m,&p.D.y);
printf("enter address land,strtno,hno,cityn");
scanf("%s%d%d%s",&p.A.land,&p.A.strtno,&p.A.hno,&p.A.city);
printf("n**********OUTPUT***********n");
printf("ID=%dnNAME=%snAGE=%dnDOB=%d/%d/%dnADDRESS=%st%dt%dt%s"
,p.id,x,p.age,p.D.d,p.D.m,p.D.y,p.A.land,p.A.strtno,p.A.hno,p.A.city);
getch();
}
Enter the details of the person:
Id,name,age
12
sara
24
enter DOB
05
04
1987
enter address land,strtno,hno,city
Mahakali_colliery
20
N/17
Chandrapur
******************OUTPUT********************
ID=12
NAME=SARA
AGE=24
DOB=05/04/1987
ADDRESS=Mahakali_colliery 20 N/17 Chandrapur

Mais conteúdo relacionado

Mais procurados

(Meta 5) ejemplo vectores 2 dev c++
(Meta 5) ejemplo vectores 2 dev c++ (Meta 5) ejemplo vectores 2 dev c++
(Meta 5) ejemplo vectores 2 dev c++
Eli Diaz
 
(Meta 5) ejemplo vectores dev c++
(Meta 5) ejemplo vectores dev c++ (Meta 5) ejemplo vectores dev c++
(Meta 5) ejemplo vectores dev c++
Eli Diaz
 

Mais procurados (14)

(Meta 5) ejemplo vectores 2 dev c++
(Meta 5) ejemplo vectores 2 dev c++ (Meta 5) ejemplo vectores 2 dev c++
(Meta 5) ejemplo vectores 2 dev c++
 
(Meta 5) ejemplo vectores dev c++
(Meta 5) ejemplo vectores dev c++ (Meta 5) ejemplo vectores dev c++
(Meta 5) ejemplo vectores dev c++
 
10 3 다중 배열
10 3 다중 배열10 3 다중 배열
10 3 다중 배열
 
C & Python Introduction
C & Python IntroductionC & Python Introduction
C & Python Introduction
 
1 (1)
1 (1)1 (1)
1 (1)
 
Binary search
Binary searchBinary search
Binary search
 
week-21x
week-21xweek-21x
week-21x
 
Program in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointersProgram in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointers
 
2 d rotation
2 d rotation2 d rotation
2 d rotation
 
Ds
DsDs
Ds
 
Data Structures : array operations in c program
Data Structures : array operations in c program Data Structures : array operations in c program
Data Structures : array operations in c program
 
Final ds record
Final ds recordFinal ds record
Final ds record
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
 
C Language Programs
C Language Programs C Language Programs
C Language Programs
 

Destaque

Jerry Romanek series mobile development 2012 year end review
Jerry Romanek series   mobile development 2012 year end reviewJerry Romanek series   mobile development 2012 year end review
Jerry Romanek series mobile development 2012 year end review
Leigh Williamson
 
IBM InterConnect Build and Deploy MobileFirst Applications
IBM InterConnect Build and Deploy MobileFirst ApplicationsIBM InterConnect Build and Deploy MobileFirst Applications
IBM InterConnect Build and Deploy MobileFirst Applications
Leigh Williamson
 

Destaque (9)

Pulse 2013 Mobile Build and Connect presentation
Pulse 2013 Mobile Build and Connect presentationPulse 2013 Mobile Build and Connect presentation
Pulse 2013 Mobile Build and Connect presentation
 
UK Innovate 2012 mobile keynote
UK Innovate 2012 mobile keynoteUK Innovate 2012 mobile keynote
UK Innovate 2012 mobile keynote
 
Jerry Romanek series mobile development 2012 year end review
Jerry Romanek series   mobile development 2012 year end reviewJerry Romanek series   mobile development 2012 year end review
Jerry Romanek series mobile development 2012 year end review
 
IBM Presentation for Mobile Developer Summit India
IBM Presentation for Mobile Developer Summit IndiaIBM Presentation for Mobile Developer Summit India
IBM Presentation for Mobile Developer Summit India
 
DevBeat 2013 IBM Master Class presentation
DevBeat 2013 IBM Master Class presentationDevBeat 2013 IBM Master Class presentation
DevBeat 2013 IBM Master Class presentation
 
June 25 webcast adding mobile to power applications
June 25 webcast   adding mobile to power applicationsJune 25 webcast   adding mobile to power applications
June 25 webcast adding mobile to power applications
 
Mobile Testing Presentation at IBM Pulse 2013
Mobile Testing Presentation at IBM Pulse 2013Mobile Testing Presentation at IBM Pulse 2013
Mobile Testing Presentation at IBM Pulse 2013
 
IBM InterConnect Build and Deploy MobileFirst Applications
IBM InterConnect Build and Deploy MobileFirst ApplicationsIBM InterConnect Build and Deploy MobileFirst Applications
IBM InterConnect Build and Deploy MobileFirst Applications
 
Build and Connect Enterprise Mobile Applications from developerWorks Live!
Build and Connect Enterprise Mobile Applications from developerWorks Live! Build and Connect Enterprise Mobile Applications from developerWorks Live!
Build and Connect Enterprise Mobile Applications from developerWorks Live!
 

Semelhante a Structure

C basics
C basicsC basics
C basics
MSc CST
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manual
SANTOSH RATH
 

Semelhante a Structure (20)

C basics
C basicsC basics
C basics
 
C programms
C programmsC programms
C programms
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
Arrays
ArraysArrays
Arrays
 
C programming structure & pointer
C  programming structure & pointerC  programming structure & pointer
C programming structure & pointer
 
Array Programs.pdf
Array Programs.pdfArray Programs.pdf
Array Programs.pdf
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manual
 
C file
C fileC file
C file
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
InsertionSort.pdf
InsertionSort.pdfInsertionSort.pdf
InsertionSort.pdf
 
Os lab 1st mid
Os lab 1st midOs lab 1st mid
Os lab 1st mid
 
Os lab upto_1st_mid
Os lab upto_1st_midOs lab upto_1st_mid
Os lab upto_1st_mid
 
Os lab upto 1st mid
Os lab upto 1st midOs lab upto 1st mid
Os lab upto 1st mid
 
4. chapter iii
4. chapter iii4. chapter iii
4. chapter iii
 
Bubble Sort
Bubble SortBubble Sort
Bubble Sort
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
 
Program to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical orderProgram to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical order
 

Structure