SlideShare a Scribd company logo
2
Most read
3
Most read
5
Most read
Programming Fundamentals
Group
Structured Programming
What is Structured Programming?
In structured programming,we divide
the whole program into small
modules, so that program become
easy to understand.
Why we use Structured Programming?
• We use structured programming because it
enables the programmer to understand the
program easily.
• If a program consists of thousands of instructions
and an error occurs than it is very difficult to find
that error in the whole program but in structured
programming we can easily detect the error and
then go to that location and correct it.
• This saves a lot of time.
Structured Programming Concepts
• Top Down Design.
• Code reusability.
• Information hiding.
Function
• We divide the whole program in to small
blocks called functions.
• Function is a block of statements that are
executed to perform a task.
• Function plays an important role in structured
programming.
• Using a function is like hiring a person to do a
specific job.
Function Call :
• When a function is called by its name the control
moves to the function definition and executes all
the statements written in it
• Semi colon is used after the name of function.
Function Definition :
• Function definition contains the instructions that
are executed when a function is called
• Semi colon is not used after the name of function.
Function call and definition
main()
{
message();
printf(“Hello world n”);
}
message()
{
printf(“Message function n”);
}
Waiting
Function
call
Function
definition
Points to remember
• C program must contains at least one function
• Execution of C program begins with main() function.
• If there are more than one function then one function
must be main()
• There is no limit on number of functions in C program
• Functions in a program are called in sequence as
mentioned in main() function
• After the execution of function control returns to
main()
• A function can call itself such a process is called
recursion.
main()
{
printf("During Summer ");
wakeup();
milk();
Study();
Play();
Sleep();
system("pause");
}
study()
{
printf("I study at 2’pm");
}
wakeup()
{
printf("I wake up at 6'am");
}
milk()
{
printf("I drink milk at 8'am");
}
Sleep()
{
printf("I sleep at 9'pm");
}
Play()
{
printf("I play at 3'pm");
}
Function Call Function Definition
Function Prototype
Function prototype contains following things about
the function:
• The data type returned by the function
• The number of parameters received
• The data types of the parameters
• The order of the parameters
• If there is no datatype and return value then we
use void at the place of datatype and perameters
int m(int,int);
main()
{
int a,b,Mul;
printf("Enter the values of a and b");
scanf("%d%d",&a,&b);
Mul=m(a,b);
printf("Multiplication of a & b is %d",Mul);
system("pause");
}
m(int x,int y)
{
int mul;
mul=x*y;
return(mul);
}
Function prototype
Function Call
Function Definition
Imp Point
• A function can return only one value at a time
for example these statements are invalid:
Return(a,b);
Return(x,12);
Return value Program
int m(int,int);
main()
{
int a,b,Mul;
printf("Enter the values of a and b");
scanf("%d%d",&a,&b);
Mul=m(a,b);
printf("Multiplication of a & b is %d",Mul);
system("pause");
}
m(int x,int y)
{
int mul;
mul=x*y;
return(mul);
}
• If the value of a formal argument is changed in the
called function, the corresponding change does not
take place in the calling function. For example
30a
60b
Variable Scope
• Variable scope determine the area in a program where
variable can be accessed.
• When a variable loses its scope, it means its data value
is lost
• Common types of variables in C,
– local
– global
• Global variable can be accessed any where in a
program
• Local variable can be accessed only in that function in
which it is declared
Example Program
#include<stdio.h>
int a,b; Global Variable
main()
{
printf("Enter the values of a & b");
scanf("%d%d",&a,&b);
sum(a,b);
system("pause");
}
sum(inta,intb)
{
int c; Local Variable
c=a+b;
printf("Sum is %d",c);
}
structured programming
structured programming

More Related Content

What's hot (20)

PPTX
Compiler vs interpreter
Paras Patel
 
PPTX
File handling in Python
Megha V
 
PPTX
Stream classes in C++
Shyam Gupta
 
PDF
Polymorphism in oop
MustafaIbrahimy
 
PPTX
Command line arguments
Ashok Raj
 
PPTX
Unit1 principle of programming language
Vasavi College of Engg
 
PDF
Object oriented programming c++
Ankur Pandey
 
PPT
Object-oriented concepts
BG Java EE Course
 
PPT
Class and object in C++
rprajat007
 
PPT
File handling in c
David Livingston J
 
PPTX
Java
Tony Nguyen
 
PDF
Logic programming (1)
Nitesh Singh
 
PPTX
Java exception handling
BHUVIJAYAVELU
 
ODP
Python Modules
Nitin Reddy Katkam
 
PPTX
File Management in Operating System
Janki Shah
 
PPTX
object oriented Programming ppt
Nitesh Dubey
 
PPTX
Scheduling Definition, objectives and types
Maitree Patel
 
PPTX
Inheritance in c++
Vineeta Garg
 
PPT
Introduction to Python
Nowell Strite
 
Compiler vs interpreter
Paras Patel
 
File handling in Python
Megha V
 
Stream classes in C++
Shyam Gupta
 
Polymorphism in oop
MustafaIbrahimy
 
Command line arguments
Ashok Raj
 
Unit1 principle of programming language
Vasavi College of Engg
 
Object oriented programming c++
Ankur Pandey
 
Object-oriented concepts
BG Java EE Course
 
Class and object in C++
rprajat007
 
File handling in c
David Livingston J
 
Logic programming (1)
Nitesh Singh
 
Java exception handling
BHUVIJAYAVELU
 
Python Modules
Nitin Reddy Katkam
 
File Management in Operating System
Janki Shah
 
object oriented Programming ppt
Nitesh Dubey
 
Scheduling Definition, objectives and types
Maitree Patel
 
Inheritance in c++
Vineeta Garg
 
Introduction to Python
Nowell Strite
 

Similar to structured programming (20)

PPT
eee2-day4-structures engineering college
2017eee0459
 
PPT
User Defined Functions in C
RAJ KUMAR
 
PDF
cp Module4(1)
Amarjith C K
 
PPT
An imperative study of c
Tushar B Kute
 
PDF
functionsinc-130108032745-phpapp01.pdf
mounikanarra3
 
PPTX
luckfuckfunctioneekefkfejewnfiwnfnenf.pptx
TriggeredZulkar
 
PPTX
User defined functions
Rokonuzzaman Rony
 
PDF
Function
Kathmandu University
 
PPTX
Unit-III.pptx
Mehul Desai
 
PPT
Functions and pointers_unit_4
MKalpanaDevi
 
ODP
Function
jayesh30sikchi
 
PPTX
Functions
PralhadKhanal1
 
PDF
Programming in C Functions PPT Presentation.pdf
Ramesh Wadawadagi
 
DOC
4. function
Shankar Gangaju
 
PPTX
Functions in C
Shobhit Upadhyay
 
PPT
Functions and pointers_unit_4
Saranya saran
 
DOCX
Introduction to c programming
AMAN ANAND
 
PPTX
Functions
Golda Margret Sheeba J
 
PDF
User_Defined_Functions_ppt_slideshare.
NabeelaNousheen
 
PPTX
Functions in C.pptx
Ashwini Raut
 
eee2-day4-structures engineering college
2017eee0459
 
User Defined Functions in C
RAJ KUMAR
 
cp Module4(1)
Amarjith C K
 
An imperative study of c
Tushar B Kute
 
functionsinc-130108032745-phpapp01.pdf
mounikanarra3
 
luckfuckfunctioneekefkfejewnfiwnfnenf.pptx
TriggeredZulkar
 
User defined functions
Rokonuzzaman Rony
 
Unit-III.pptx
Mehul Desai
 
Functions and pointers_unit_4
MKalpanaDevi
 
Function
jayesh30sikchi
 
Functions
PralhadKhanal1
 
Programming in C Functions PPT Presentation.pdf
Ramesh Wadawadagi
 
4. function
Shankar Gangaju
 
Functions in C
Shobhit Upadhyay
 
Functions and pointers_unit_4
Saranya saran
 
Introduction to c programming
AMAN ANAND
 
User_Defined_Functions_ppt_slideshare.
NabeelaNousheen
 
Functions in C.pptx
Ashwini Raut
 
Ad

Recently uploaded (20)

PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Tally software_Introduction_Presentation
AditiBansal54083
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Ad

structured programming

  • 2. Structured Programming What is Structured Programming? In structured programming,we divide the whole program into small modules, so that program become easy to understand.
  • 3. Why we use Structured Programming? • We use structured programming because it enables the programmer to understand the program easily. • If a program consists of thousands of instructions and an error occurs than it is very difficult to find that error in the whole program but in structured programming we can easily detect the error and then go to that location and correct it. • This saves a lot of time.
  • 4. Structured Programming Concepts • Top Down Design. • Code reusability. • Information hiding.
  • 5. Function • We divide the whole program in to small blocks called functions. • Function is a block of statements that are executed to perform a task. • Function plays an important role in structured programming. • Using a function is like hiring a person to do a specific job.
  • 6. Function Call : • When a function is called by its name the control moves to the function definition and executes all the statements written in it • Semi colon is used after the name of function. Function Definition : • Function definition contains the instructions that are executed when a function is called • Semi colon is not used after the name of function.
  • 7. Function call and definition main() { message(); printf(“Hello world n”); } message() { printf(“Message function n”); } Waiting Function call Function definition
  • 8. Points to remember • C program must contains at least one function • Execution of C program begins with main() function. • If there are more than one function then one function must be main() • There is no limit on number of functions in C program • Functions in a program are called in sequence as mentioned in main() function • After the execution of function control returns to main() • A function can call itself such a process is called recursion.
  • 9. main() { printf("During Summer "); wakeup(); milk(); Study(); Play(); Sleep(); system("pause"); } study() { printf("I study at 2’pm"); } wakeup() { printf("I wake up at 6'am"); } milk() { printf("I drink milk at 8'am"); } Sleep() { printf("I sleep at 9'pm"); } Play() { printf("I play at 3'pm"); } Function Call Function Definition
  • 10. Function Prototype Function prototype contains following things about the function: • The data type returned by the function • The number of parameters received • The data types of the parameters • The order of the parameters • If there is no datatype and return value then we use void at the place of datatype and perameters
  • 11. int m(int,int); main() { int a,b,Mul; printf("Enter the values of a and b"); scanf("%d%d",&a,&b); Mul=m(a,b); printf("Multiplication of a & b is %d",Mul); system("pause"); } m(int x,int y) { int mul; mul=x*y; return(mul); } Function prototype Function Call Function Definition
  • 12. Imp Point • A function can return only one value at a time for example these statements are invalid: Return(a,b); Return(x,12);
  • 13. Return value Program int m(int,int); main() { int a,b,Mul; printf("Enter the values of a and b"); scanf("%d%d",&a,&b); Mul=m(a,b); printf("Multiplication of a & b is %d",Mul); system("pause"); } m(int x,int y) { int mul; mul=x*y; return(mul); }
  • 14. • If the value of a formal argument is changed in the called function, the corresponding change does not take place in the calling function. For example 30a 60b
  • 15. Variable Scope • Variable scope determine the area in a program where variable can be accessed. • When a variable loses its scope, it means its data value is lost • Common types of variables in C, – local – global • Global variable can be accessed any where in a program • Local variable can be accessed only in that function in which it is declared
  • 16. Example Program #include<stdio.h> int a,b; Global Variable main() { printf("Enter the values of a & b"); scanf("%d%d",&a,&b); sum(a,b); system("pause"); } sum(inta,intb) { int c; Local Variable c=a+b; printf("Sum is %d",c); }