Welcome to our presentation
Group Members: ID:
1.152-15-5983 Arafat Rahman
2.152-15-6049 Mahdi Hasan
3.152-15-6051 Mst. Rubaya Rumi
4.152-15-6057 Asfakur Rahman
152-15-6060 Ahmed Muhtasim
Anjum
CHAPTER
STRUCTURE OF C
LANGUAGE
Basic Structure of C Program
• The C programming language is a
popular and widely used programming
language for creating computer
programs.
• Benefits you gain from learning C:
1) be able to read and write code for a large
number of platforms
2) The jump to the object oriented C++
language becomes much easier.
Basic Structure of C Program
• C is what is called a compiled language
• This means that once you write your C
program, you must run it through a C
compiler
• The C program is the human-readable
form, while the executable that comes
out of the compiler is the machine-
readable
• What this means is that to write and run a
C program, you must have access to a C
compiler
Basic Structure of C Program
Basic Structure of C Program
• A C program contains these following
basic structures:
1) Comments
2) The #include Directive (C-library)
3) The main() function
4) Variables and Data type
5) C statement
6) Function Body
Basic Structure of C Program
/*This is a basic structure C program*/
#include <stdio.h>
void main ()
{
int miles = 26;
int yards;
float kilometers;
kilometers = 1.609 *(miles+yards/1760.0);
printf(“n A marathon is %f kms”,kilometers);
}
1
2
3
4
5
Basic Structure of C Program
Basic Structure of C Program
1.Comments
• To document programs & improve
readability
• Optional & non-executable statement
• Symbols /* and */ or // indicate the
beginning and the end of the comment
block
Basic Structure of C Program
/*A comment may be coded like this*/
//A comment may be coded like this
Note:
1. There is no space between (*) and slash (/)
2. Every /* (begin) must be matched with */ (end)
Basic Structure of C Program
2.The #include Directive
• Lines beginning with a pound sign (#) are
directives for the preprocessor
• The preprocessor is a utility program that
performs various modifications to the source
program
• A header file contains the source code that
allows the execution of the program
• Standard input/output header file replaces the
directive in the source code
Basic Structure of C Program
• The stdio.h header file enables the program to
perform basic input and output operations
• Allows the program to accept input from the
keyboard and display output on the screen
Basic Structure of C Program
#include <stdio.h>
Header File
Note:
1. Lines that start with the # sign are preprocessor
directives
2. The angled-bracket pair <> indicates that the
specified library file is the standard library
directory
Basic Structure of C Program
3. The main() function
• The main function is the point by where all
C programs start their execution
• The instructions contained within this
function's definition will always be the first
ones to be executed in any C program
• The word main is followed in the code by a
pair of parentheses (())
• These parentheses may enclose a list of
parameters within them
Basic Structure of C Program
• Right after these parentheses we can find the
body of the main function enclosed in braces
{ - Left Braces
} – Right Braces
–What is contained within these braces is
what the function does when it is executed
Basic Structure of C Program
Format:
data type function_name (parameters)
{
variable;
C statement;
}
void main ()
{
Statement;
Statement;
…………..;
…………..;
}
Body
Basic Structure of C Program
4. Variables and Identifiers
• If your program requests a value from the
user, or if it calculates a value, you will
want to remember it somewhere so you
can use it later. The way your program
remembers things is by using variables.
For example;
int b;
• A variable has a name (in this case, b) and
a type (in this case, int, an integer).
variableIdentifier
Basic Structure of C Program
• Each variable needs an identifier that distinguishes
it from the others
• A valid identifier is a sequence of one or more
letters, digits or underline characters _
• Variable identifiers always have to begin with a
letter
• They can also begin with an underline character _
, but this is usually reserved for compiler specific
keywords or external identifiers
• Identifiers cannot match with any reserve keywords
Basic Structure of C Program
Very important:
The C language is a "case sensitive" language. That means that
an identifier written in capital letters is not equivalent to
another one with the same name but written in small letters.
Basic Structure of C Program
5. Data Types
• The basic fundamental data types in C
Basic Structure of C Program
6. Reserved Keywords
• All reserved words appear in
lowercase
• What is the difference between
reserved words and standard
identifiers?
• The standard reserved keywords are;
Basic Structure of C Program
Keywords
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
Basic Structure of C Program
7) Constants
Numeric Constant
• Two types of constants; numeric constant and
symbolic constant
• Numeric constant- actual value assigned to
numeric variable, include integer and floating-
point values
• Integer constant- consists of digits and a unary
sign (+ or -)
• Floating point constant- Is a real number, a
numeric value with a decimal point
Basic Structure of C Program
Symbolic Constant
• Purpose is to define symbolic constant
• Symbolic constants are coded in
uppercase letters and retains its value
during the program run
• Normally placed at the beginning of
the program
• e.g: #define VALUE 100
Basic Structure of C Program
Non-numeric constants
• Character and string
• Character constant-is a single character
assigned to a character variable
• String constant- is a group of characters
assigned to a string variable
• Character constant = ‘R’ ‘n’ ‘$’
• String constant = “October 5th”
Structure

More Related Content

PPTX
Java interface
PPTX
classes and objects in C++
PDF
Object oriented programming c++
PPTX
Input and Output In C Language
PDF
Programming Fundamentals Functions in C and types
PPTX
Function in c
PPTX
Presentation on Function in C Programming
PPTX
INLINE FUNCTION IN C++
Java interface
classes and objects in C++
Object oriented programming c++
Input and Output In C Language
Programming Fundamentals Functions in C and types
Function in c
Presentation on Function in C Programming
INLINE FUNCTION IN C++

What's hot (20)

PPTX
Functional modeling
PPTX
Access Modifier.pptx
PPTX
Data Structures and Algorithm - Module 1.pptx
PPT
Function overloading(c++)
PPTX
Templates in c++
PDF
Methods in Java
PPTX
OOP Introduction with java programming language
PPTX
Functions in c
PPTX
java interface and packages
PPTX
for loop in java
PPTX
Data types in C
PPTX
Characteristics of OOPS
PPTX
Function overloading and overriding
PPTX
Basics of JAVA programming
PPT
PPTX
Polymorphism In c++
PDF
Constructor and Destructor
PPTX
Ch.1 oop introduction, classes and objects
PPT
Expressions in c++
Functional modeling
Access Modifier.pptx
Data Structures and Algorithm - Module 1.pptx
Function overloading(c++)
Templates in c++
Methods in Java
OOP Introduction with java programming language
Functions in c
java interface and packages
for loop in java
Data types in C
Characteristics of OOPS
Function overloading and overriding
Basics of JAVA programming
Polymorphism In c++
Constructor and Destructor
Ch.1 oop introduction, classes and objects
Expressions in c++
Ad

Viewers also liked (7)

PPT
Fundamental Programming Lect 1
PPTX
BASIC Programming Language
PPT
Programming fundamentals lecture 1&2
PPS
C programming session 01
PPSX
C language (Collected By Dushmanta)
PPT
20. Object-Oriented Programming Fundamental Principles
PPTX
Fundamental Programming Lect 1
BASIC Programming Language
Programming fundamentals lecture 1&2
C programming session 01
C language (Collected By Dushmanta)
20. Object-Oriented Programming Fundamental Principles
Ad

Similar to Structure (20)

PPTX
PPTX
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
PPTX
PPTX
Unit-1 (introduction to c language).pptx
PDF
Learning the C Language
PPTX
C lang7age programming powerpoint presentation
PPT
Chapter-2 edited on Programming in Can refer this ppt
PPT
Introduction To Programming subject1.ppt
PPTX
Unit ii
PDF
Introduction to the c programming language (amazing and easy book for beginners)
PDF
Rr
PDF
C pdf
PPTX
structure of a c program - slideshare.pptx
PPT
490450755-Chapter-2.ppt
PPT
490450755-Chapter-2.ppt
PPTX
Introduction of c programming unit-ii ppt
PPTX
Basic Structure of C Language and Related Term
PPTX
C_Programming_Notes_ICE
PPTX
Basic C Structure and related terms with example
PPTX
4 Introduction to C.pptxSSSSSSSSSSSSSSSS
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
Unit-1 (introduction to c language).pptx
Learning the C Language
C lang7age programming powerpoint presentation
Chapter-2 edited on Programming in Can refer this ppt
Introduction To Programming subject1.ppt
Unit ii
Introduction to the c programming language (amazing and easy book for beginners)
Rr
C pdf
structure of a c program - slideshare.pptx
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
Introduction of c programming unit-ii ppt
Basic Structure of C Language and Related Term
C_Programming_Notes_ICE
Basic C Structure and related terms with example
4 Introduction to C.pptxSSSSSSSSSSSSSSSS

Recently uploaded (20)

PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
semiconductor packaging in vlsi design fab
PPTX
Education and Perspectives of Education.pptx
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
English Textual Question & Ans (12th Class).pdf
PPTX
Computer Architecture Input Output Memory.pptx
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PDF
Complications of Minimal Access-Surgery.pdf
PDF
Empowerment Technology for Senior High School Guide
PDF
Race Reva University – Shaping Future Leaders in Artificial Intelligence
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PPTX
Introduction to pro and eukaryotes and differences.pptx
Unit 4 Computer Architecture Multicore Processor.pptx
semiconductor packaging in vlsi design fab
Education and Perspectives of Education.pptx
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
English Textual Question & Ans (12th Class).pdf
Computer Architecture Input Output Memory.pptx
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
Environmental Education MCQ BD2EE - Share Source.pdf
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
Complications of Minimal Access-Surgery.pdf
Empowerment Technology for Senior High School Guide
Race Reva University – Shaping Future Leaders in Artificial Intelligence
Cambridge-Practice-Tests-for-IELTS-12.docx
AI-driven educational solutions for real-life interventions in the Philippine...
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
Introduction to pro and eukaryotes and differences.pptx

Structure

  • 1. Welcome to our presentation Group Members: ID: 1.152-15-5983 Arafat Rahman 2.152-15-6049 Mahdi Hasan 3.152-15-6051 Mst. Rubaya Rumi 4.152-15-6057 Asfakur Rahman 152-15-6060 Ahmed Muhtasim Anjum
  • 3. Basic Structure of C Program • The C programming language is a popular and widely used programming language for creating computer programs. • Benefits you gain from learning C: 1) be able to read and write code for a large number of platforms 2) The jump to the object oriented C++ language becomes much easier.
  • 4. Basic Structure of C Program • C is what is called a compiled language • This means that once you write your C program, you must run it through a C compiler • The C program is the human-readable form, while the executable that comes out of the compiler is the machine- readable • What this means is that to write and run a C program, you must have access to a C compiler
  • 5. Basic Structure of C Program
  • 6. Basic Structure of C Program • A C program contains these following basic structures: 1) Comments 2) The #include Directive (C-library) 3) The main() function 4) Variables and Data type 5) C statement 6) Function Body
  • 7. Basic Structure of C Program /*This is a basic structure C program*/ #include <stdio.h> void main () { int miles = 26; int yards; float kilometers; kilometers = 1.609 *(miles+yards/1760.0); printf(“n A marathon is %f kms”,kilometers); } 1 2 3 4 5
  • 8. Basic Structure of C Program
  • 9. Basic Structure of C Program 1.Comments • To document programs & improve readability • Optional & non-executable statement • Symbols /* and */ or // indicate the beginning and the end of the comment block
  • 10. Basic Structure of C Program /*A comment may be coded like this*/ //A comment may be coded like this Note: 1. There is no space between (*) and slash (/) 2. Every /* (begin) must be matched with */ (end)
  • 11. Basic Structure of C Program 2.The #include Directive • Lines beginning with a pound sign (#) are directives for the preprocessor • The preprocessor is a utility program that performs various modifications to the source program • A header file contains the source code that allows the execution of the program • Standard input/output header file replaces the directive in the source code
  • 12. Basic Structure of C Program • The stdio.h header file enables the program to perform basic input and output operations • Allows the program to accept input from the keyboard and display output on the screen
  • 13. Basic Structure of C Program #include <stdio.h> Header File Note: 1. Lines that start with the # sign are preprocessor directives 2. The angled-bracket pair <> indicates that the specified library file is the standard library directory
  • 14. Basic Structure of C Program 3. The main() function • The main function is the point by where all C programs start their execution • The instructions contained within this function's definition will always be the first ones to be executed in any C program • The word main is followed in the code by a pair of parentheses (()) • These parentheses may enclose a list of parameters within them
  • 15. Basic Structure of C Program • Right after these parentheses we can find the body of the main function enclosed in braces { - Left Braces } – Right Braces –What is contained within these braces is what the function does when it is executed
  • 16. Basic Structure of C Program Format: data type function_name (parameters) { variable; C statement; } void main () { Statement; Statement; …………..; …………..; } Body
  • 17. Basic Structure of C Program 4. Variables and Identifiers • If your program requests a value from the user, or if it calculates a value, you will want to remember it somewhere so you can use it later. The way your program remembers things is by using variables. For example; int b; • A variable has a name (in this case, b) and a type (in this case, int, an integer). variableIdentifier
  • 18. Basic Structure of C Program • Each variable needs an identifier that distinguishes it from the others • A valid identifier is a sequence of one or more letters, digits or underline characters _ • Variable identifiers always have to begin with a letter • They can also begin with an underline character _ , but this is usually reserved for compiler specific keywords or external identifiers • Identifiers cannot match with any reserve keywords
  • 19. Basic Structure of C Program Very important: The C language is a "case sensitive" language. That means that an identifier written in capital letters is not equivalent to another one with the same name but written in small letters.
  • 20. Basic Structure of C Program 5. Data Types • The basic fundamental data types in C
  • 21. Basic Structure of C Program 6. Reserved Keywords • All reserved words appear in lowercase • What is the difference between reserved words and standard identifiers? • The standard reserved keywords are;
  • 22. Basic Structure of C Program Keywords auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if static while
  • 23. Basic Structure of C Program 7) Constants Numeric Constant • Two types of constants; numeric constant and symbolic constant • Numeric constant- actual value assigned to numeric variable, include integer and floating- point values • Integer constant- consists of digits and a unary sign (+ or -) • Floating point constant- Is a real number, a numeric value with a decimal point
  • 24. Basic Structure of C Program Symbolic Constant • Purpose is to define symbolic constant • Symbolic constants are coded in uppercase letters and retains its value during the program run • Normally placed at the beginning of the program • e.g: #define VALUE 100
  • 25. Basic Structure of C Program Non-numeric constants • Character and string • Character constant-is a single character assigned to a character variable • String constant- is a group of characters assigned to a string variable • Character constant = ‘R’ ‘n’ ‘$’ • String constant = “October 5th”