SlideShare a Scribd company logo
1 of 11
C- PROGRAMMING 
STRUCTURE & UNION
EXTRA
EXTRA
NOTES
NOTES
#include<stdio.h> 
#include<conio.h> 
struct student 
{ 
char name[20]; 
int marks; 
float per; 
}; 
void main() 
{ 
struct student stu; 
clrscr(); 
printf(“Enter Student Namen”); 
gets(stu.name); 
printf(“Enter Student Marksn”); 
scanf(“%d”,&stu.marks); 
printf(“Enter Percentagen”); 
scanf(“%f ”,&stu.per); 
printf(“NAME :”); 
puts(stu.name); 
printf(“MARKS :%dn”,stu.marks); 
printf(“PERCENTAGE :%fn”,stu.per); 
getch(); 
} 
EXTRA
#include<stdio.h> Structure within structure 
#include<conio.h> 
struct address 
{ 
char street[10]; 
char city[10]; 
char state[10]; 
}; 
struct employee 
{ 
char name[20]; 
char des[10]; 
struct address add; 
int salary; 
}; 
void main() 
{ 
struct employee emp; 
clrscr(); 
printf("Enter Employee detailsn"); 
printf("Enter Namen"); 
gets(emp.name); 
EXTRA
printf("Enter Designationn"); 
gets(emp.des); 
printf("Enter Addressn"); 
printf("Enter street n"); 
gets(emp.add.street); 
printf("Enter Cityn"); 
gets(emp.add.city); 
printf("Enter Staten"); 
gets(emp.add.state); 
printf("Enter Slalryn"); 
scanf("%d",&emp.salary); 
printf("EMPLOYEE DETAILSn"); 
printf("NAME :"); 
puts(emp.name); 
printf("DESIGNATION :"); 
puts(emp.des); 
printf("ADDRESS :n"); 
printf("STREET :"); 
puts(emp.add.street); 
printf("CITY :"); 
puts(emp.add.city); 
printf("STATE :"); 
puts(emp.add.state); 
printf("SALARY :%dn",emp.salary) ; 
getch(); 
} 
EXTRA
EXTRA
NOTES
#include<stdio.h> 
#include<conio.h> 
union marks 
{ int phy; 
int che; 
int mat; 
int total; 
float per; 
}s1; 
void main() 
{ 
clrscr(); 
printf("Enter Marks detailsn"); 
printf("Enter physics marksn"); 
scanf("%d",&s1.phy); 
printf("Enter chemistry marksn"); 
scanf("%d",&s1.che); 
printf("Enter Math Marksn"); 
scanf("%d",&s1.mat); 
s1.total=s1.phy+s1.che+s1.mat; 
printf("Total Marks = %dn",s1.total); 
s1.per=s1.total*1/3; 
printf("Percentage = %fn",s1.per); 
getch(); 
} 
EXTRA

More Related Content

What's hot

Ch6 pointers (latest)
Ch6 pointers (latest)Ch6 pointers (latest)
Ch6 pointers (latest)Hattori Sidek
 
Function pointer
Function pointerFunction pointer
Function pointerGem WeBlog
 
Pointers and Structures
Pointers and StructuresPointers and Structures
Pointers and StructuresGem WeBlog
 
Structure & Union in C++
Structure & Union in C++Structure & Union in C++
Structure & Union in C++Davinder Kaur
 
Data structure week 3
Data structure week 3Data structure week 3
Data structure week 3karmuhtam
 
VIT351 Software Development VI Unit4
VIT351 Software Development VI Unit4VIT351 Software Development VI Unit4
VIT351 Software Development VI Unit4YOGESH SINGH
 
C programming pointer
C  programming pointerC  programming pointer
C programming pointerargusacademy
 
CPU : Structures And Unions
CPU : Structures And UnionsCPU : Structures And Unions
CPU : Structures And UnionsDhrumil Patel
 
Module 3-Functions
Module 3-FunctionsModule 3-Functions
Module 3-Functionsnikshaikh786
 
Module 5-Structure and Union
Module 5-Structure and UnionModule 5-Structure and Union
Module 5-Structure and Unionnikshaikh786
 
Programming in C session 3
Programming in C session 3Programming in C session 3
Programming in C session 3Prerna Sharma
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Stringsnikshaikh786
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introductionnikshaikh786
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4Saranya saran
 

What's hot (20)

Structure & union
Structure & unionStructure & union
Structure & union
 
Structure in c
Structure in cStructure in c
Structure in c
 
Ch6 pointers (latest)
Ch6 pointers (latest)Ch6 pointers (latest)
Ch6 pointers (latest)
 
Function pointer
Function pointerFunction pointer
Function pointer
 
Pointers and Structures
Pointers and StructuresPointers and Structures
Pointers and Structures
 
Ch5 array nota
Ch5 array notaCh5 array nota
Ch5 array nota
 
Structure & Union in C++
Structure & Union in C++Structure & Union in C++
Structure & Union in C++
 
Data structure week 3
Data structure week 3Data structure week 3
Data structure week 3
 
C Structures And Unions
C  Structures And  UnionsC  Structures And  Unions
C Structures And Unions
 
VIT351 Software Development VI Unit4
VIT351 Software Development VI Unit4VIT351 Software Development VI Unit4
VIT351 Software Development VI Unit4
 
C programming pointer
C  programming pointerC  programming pointer
C programming pointer
 
Structure c
Structure cStructure c
Structure c
 
CPU : Structures And Unions
CPU : Structures And UnionsCPU : Structures And Unions
CPU : Structures And Unions
 
Module 3-Functions
Module 3-FunctionsModule 3-Functions
Module 3-Functions
 
Module 5-Structure and Union
Module 5-Structure and UnionModule 5-Structure and Union
Module 5-Structure and Union
 
Programming in C session 3
Programming in C session 3Programming in C session 3
Programming in C session 3
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Strings
 
Arrays
ArraysArrays
Arrays
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 

Viewers also liked

Viewers also liked (20)

Structure in C
Structure in CStructure in C
Structure in C
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppt
 
C Structures & Unions
C Structures & UnionsC Structures & Unions
C Structures & Unions
 
VISUAL BASIC .net i
VISUAL BASIC .net iVISUAL BASIC .net i
VISUAL BASIC .net i
 
Application software
Application softwareApplication software
Application software
 
VISUAL BASIC .net iv
VISUAL BASIC .net ivVISUAL BASIC .net iv
VISUAL BASIC .net iv
 
VISUAL BASIC .net ii
VISUAL BASIC .net iiVISUAL BASIC .net ii
VISUAL BASIC .net ii
 
Virus examples
Virus examplesVirus examples
Virus examples
 
Multimedia basic
Multimedia basicMultimedia basic
Multimedia basic
 
C programming file handling
C  programming file handlingC  programming file handling
C programming file handling
 
Php opps
Php oppsPhp opps
Php opps
 
TALLY Payroll ENTRY
TALLY Payroll ENTRYTALLY Payroll ENTRY
TALLY Payroll ENTRY
 
Php oops1
Php oops1Php oops1
Php oops1
 
VISUAL BASIC .net iii
VISUAL BASIC .net iiiVISUAL BASIC .net iii
VISUAL BASIC .net iii
 
VISUAL BASIC .net v
VISUAL BASIC .net vVISUAL BASIC .net v
VISUAL BASIC .net v
 
Java script
Java scriptJava script
Java script
 
Virus
VirusVirus
Virus
 
TALLY 1 st level entry
TALLY 1 st level entryTALLY 1 st level entry
TALLY 1 st level entry
 
Computer development
Computer developmentComputer development
Computer development
 
COMPUTER Tips ‘n’ Tricks
COMPUTER Tips ‘n’   TricksCOMPUTER Tips ‘n’   Tricks
COMPUTER Tips ‘n’ Tricks
 

Similar to C programming structure & pointer

Similar to C programming structure & pointer (20)

C++ programming structure & union
C++ programming structure & unionC++ programming structure & union
C++ programming structure & union
 
C basics
C basicsC basics
C basics
 
Structure
StructureStructure
Structure
 
Structure
StructureStructure
Structure
 
C programms
C programmsC programms
C programms
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
 
C Programming lab
C Programming labC Programming lab
C Programming lab
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
 
4. chapter iii
4. chapter iii4. chapter iii
4. chapter iii
 
Arrays
ArraysArrays
Arrays
 
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
structurestructure
structure
 
Data struture lab
Data struture labData struture lab
Data struture lab
 
string , pointer
string , pointerstring , pointer
string , pointer
 
C programming function
C  programming functionC  programming function
C programming function
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
 
week-6x
week-6xweek-6x
week-6x
 
ภาษาซีพื้นฐาน
ภาษาซีพื้นฐานภาษาซีพื้นฐาน
ภาษาซีพื้นฐาน
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manual
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 

More from argusacademy (20)

Css & dhtml
Css  & dhtmlCss  & dhtml
Css & dhtml
 
Html table
Html tableHtml table
Html table
 
Html ordered & unordered list
Html ordered & unordered listHtml ordered & unordered list
Html ordered & unordered list
 
Html level ii
Html level  iiHtml level  ii
Html level ii
 
Html frame
Html frameHtml frame
Html frame
 
Html forms
Html formsHtml forms
Html forms
 
Html creating page link or hyperlink
Html creating page link or hyperlinkHtml creating page link or hyperlink
Html creating page link or hyperlink
 
Html basic
Html basicHtml basic
Html basic
 
Php string
Php stringPhp string
Php string
 
Php session
Php sessionPhp session
Php session
 
Php if else
Php if elsePhp if else
Php if else
 
Php creating forms
Php creating formsPhp creating forms
Php creating forms
 
Php create and invoke function
Php create and invoke functionPhp create and invoke function
Php create and invoke function
 
Php basic
Php basicPhp basic
Php basic
 
Php array
Php arrayPhp array
Php array
 
Sql query
Sql querySql query
Sql query
 
Rdbms
RdbmsRdbms
Rdbms
 
Oracle
OracleOracle
Oracle
 
Vb.net iv
Vb.net ivVb.net iv
Vb.net iv
 
Vb.net iii
Vb.net iiiVb.net iii
Vb.net iii
 

Recently uploaded

Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Recently uploaded (20)

Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

C programming structure & pointer

  • 6. #include<stdio.h> #include<conio.h> struct student { char name[20]; int marks; float per; }; void main() { struct student stu; clrscr(); printf(“Enter Student Namen”); gets(stu.name); printf(“Enter Student Marksn”); scanf(“%d”,&stu.marks); printf(“Enter Percentagen”); scanf(“%f ”,&stu.per); printf(“NAME :”); puts(stu.name); printf(“MARKS :%dn”,stu.marks); printf(“PERCENTAGE :%fn”,stu.per); getch(); } EXTRA
  • 7. #include<stdio.h> Structure within structure #include<conio.h> struct address { char street[10]; char city[10]; char state[10]; }; struct employee { char name[20]; char des[10]; struct address add; int salary; }; void main() { struct employee emp; clrscr(); printf("Enter Employee detailsn"); printf("Enter Namen"); gets(emp.name); EXTRA
  • 8. printf("Enter Designationn"); gets(emp.des); printf("Enter Addressn"); printf("Enter street n"); gets(emp.add.street); printf("Enter Cityn"); gets(emp.add.city); printf("Enter Staten"); gets(emp.add.state); printf("Enter Slalryn"); scanf("%d",&emp.salary); printf("EMPLOYEE DETAILSn"); printf("NAME :"); puts(emp.name); printf("DESIGNATION :"); puts(emp.des); printf("ADDRESS :n"); printf("STREET :"); puts(emp.add.street); printf("CITY :"); puts(emp.add.city); printf("STATE :"); puts(emp.add.state); printf("SALARY :%dn",emp.salary) ; getch(); } EXTRA
  • 10. NOTES
  • 11. #include<stdio.h> #include<conio.h> union marks { int phy; int che; int mat; int total; float per; }s1; void main() { clrscr(); printf("Enter Marks detailsn"); printf("Enter physics marksn"); scanf("%d",&s1.phy); printf("Enter chemistry marksn"); scanf("%d",&s1.che); printf("Enter Math Marksn"); scanf("%d",&s1.mat); s1.total=s1.phy+s1.che+s1.mat; printf("Total Marks = %dn",s1.total); s1.per=s1.total*1/3; printf("Percentage = %fn",s1.per); getch(); } EXTRA