SlideShare a Scribd company logo
BATRA COMPUTER
CENTRE ISO CERTIFIED
PHNO: 9729666670, 4000670
Introduction
 C is a general purpose language which is very closely associated
with UNIX for which it was developed in Bell Laboratories.
 Most of the programs of UNIX are written and run with the help
of 'C'.
 Many of the important ideas of 'c' stem are from BCPL by Martin
Richards.
 In 1972, Denies Ritchie at Bell Laboratories wrote C Language
which caused a revolution in computing world .
 From beginning C was intended to be useful for busy programmers
to get things done easily because C is powerful, dominant and
supple language.
Why Name 'C' was given to this language?
 Many of the ideas of C language were
derived and taken from 'B' language.
 BCPL and CPL are previous versions of 'B'
language.
 As many features came from B it was
named as 'C'.
ABOUT “C”
o C is a structured programming language
o C supports functions that enables easy
maintainability of code, by breaking large file
into smaller modules
o Comments in C provides easy readability
o C is a powerful language.
o C programs built from
• Variable and type declarations
• Functions
• Statements
• Expressions
 C programming language - Structured and
disciplined approach to program design.
C programming Training in Ambala ! Batra Computer Centre
Structure Of “C” Programs
 Before going and reading the structure of C
programs we need to have a basic knowledge
of the following:
1. C's Character Set
2. C's Keywords
3. The General Structure of a 'C' Program
4. How To End A Statement
5. Free Format Language
6. Header Files & Library Functions
C's Character Set
C does not use every character set and key found on
modern computers . The only characters that C -
Language uses for its programs are as follows:
 A-Z all alphabets
 a-z all alphabets
 0-9
 # % & ! _ {} [] () $$$$ &&&& |
 space . , : ; ' $ "
 + - / * =
 "Keywords" are words that have special meaning to
the C compiler.
 Their meaning cannot be changed at any instance.
 Serve as basic building blocks for program
statements.
 All keywords are written in only lowercase.
The keywords
#include<stdio.h>
#include<conio.h>
void main()
{
-- other statements
}
Basic Structure Of “C” Programs
Header Files
Indicates Starting
of Program
Entry Point Of
Program
 The files that are specified in the include
section is called as Header File.
 These are precompiled files that has some
functions defined in them.
 We can call those functions in our program
by supplying parameters.
 Header file is given an extension .h .
 C Source file is given an extension .c .
Header files
 This is the “Entry Point” of a program.
 When a file is executed, the start point is the
main function.
 From main function the flow goes as per the
programmers choice.
 There may or may not be other functions
written by user in a program.
 Main function is compulsory for any C
program.
Main function
 Type a program.
 Save it.
 Compile the program – This will generate an
.exe file (executable)
 Run the program (Actually the exe created out
of compilation will run and not the .c file)
 In different compiler we have different option
for compiling and running.
Running a ‘C’ Program
 The smallest individual units in a C program are known as
tokens. In a C source program, the basic element recognized by
the compiler is the "token." A token is source-program text that
the compiler does not break down into component elements.
 C has 6 different types of tokens viz.
1. Keywords [e.g. float, int, while]
2. Identifiers [e.g. main, amount]
3. Constants [e.g. -25.6, 100]
4. Strings [e.g. “SMIT”, “year”]
5. Special Symbols [e.g. {, }, [, ] ]
6. Operators [e.g. +, -, *]
 C - programs are written using these tokens and the general
syntax.
“C” language TOKENS
Strin
gs
Keywords in Ansi “C”
switch
typedef
union
unsigned
void
volatile
while
long
register
return
short
signed
sizeof
static
struct
int
double
else
enum
etern
float
for
goto
if
auto
break
case
char
const
continue
default
do
 They are programmer-chosen names to represent parts of
the program: variables, functions, etc.
 Cannot use C keywords as identifiers
 Must begin with alpha character or _, followed by alpha,
numeric, or _
 Upper- and lower-case characters are important (case-
sensitive)
 Must consist of only letters, digits or underscore ( _ ).
 Only first 31 characters are significant.
 Must NOT contain spaces ( ).
The Identifiers
 Constants in C are the fixed values that do
not change during the execution of a program.
Constants
CONSTANTS
Numeric constants Character constants
Integer
Constants
Real
Constants
Single
Character
Constants
String
Constants
• Integer Constants
– Refers to sequence of digits such as decimal integer, octal
integer and hexadecimal integer.
– Some of the examples are 112, 0551, 56579u, 0X2 etc.
• Real Constants
– The floating point constants such as 0.0083, -0.78, +67.89 etc.
• Single Character Constants
– A single char const contains a single character enclosed within
pair of single quotes [ ‘ ’ ]. For example, ‘8’, ‘a’ , ‘i’ etc.
• String Constants
– A string constant is a sequence of characters enclosed in double
quotes [ “ ” ]; For example, “0211”, “Stack Overflow” etc.
Constants Examples
DECLARATIONS
 Constants and variables must be declared before
they can be used.
 A constant declaration specifies the type, the
name and the value of the constant.
 any attempt to alter the value of a variable defined
 as constant results in an error message by
the compiler
 A variable declaration specifies the type, the name
and possibly the initial value of the variable.
 When you declare a constant or a variable, the
compiler:
 Reserves a memory location in which to store the
value of the constant or variable.
 Associates the name of the constant or variable
with the memory location.
A Variable is a data name that is used to store any
data value.
Variables are used to store values that can be
changed during the program execution.
Variables in C have the same meaning as variables
in algebra. That is, they represent some unknown, or
variable, value.
x = a + b
z + 2 = 3(y - 5)
Remember that variables in algebra are represented
by a single alphabetic character.
What Are Variables in C?
Naming Variables
Variables in C may be given representations containing
multiple characters. But there are rules for these
representations.
Variable names in C :
 May only consist of letters, digits, and underscores
 May be as long as you like, but only the first 31
characters are significant
 May not begin with a number
 May not be a C reserved word (keyword)
 Should start with a letter or an underscore(_)
 Can contain letters, numbers or underscore.
 No other special characters are allowed including space.
Case Sensitivity
 C is a case sensitive language.
 It matters whether an identifier, such as a
variable name, is uppercase or lowercase.
 Example:
area
Area
AREA
ArEa
are all seen as different variables by the
compiler.
Declaring Variables
 Before using a variable, you must give the compiler some
information about the variable; i.e., you must declare it.
 The declaration statement includes the data type of the
variable.
 Examples of variable declarations:
int length ;
float area ;
 Variables are not automatically initialized. For example, after
declaration
int sum;
the value of the variable sum can be anything (garbage).
 Thus, it is good practice to initialize variables when they are
declared.
 Once a value has been placed in a variable it stays there
until the program alters it.
There are three classes of data types here::
Primitive data types
int, float, double, char
Aggregate OR derived data types
Arrays come under this category
Arrays can contain collection of int or float or char
or double data
User defined data types
Structures and enum fall under this category.
Data types in ‘ansi c’
Data Types- different attributes
Type Size Representation Minimum range Maximum range
char, signed char 8 bits ASCII -128 127
unsigned char bool 8 bits ASCII 0 255
short, signed short 16 bits 2's complement -32768 32767
unsigned short 16 bits Binary 0 65535
int, signed int 16 bits 2's complement -32768 32767
unsigned int 16 bits Binary 0 65535
long, signed long 32 bits 2's complement -2,147,483,648 2,147,483,647
unsigned long 32 bits Binary 0 4,294,967,295
float 32 bits IEEE 32-bit 1.175495e-38 3.4028235e+38
double 32 bits IEEE 32-bit 1.175495e-38 3.4028235e+38
long double 32 bits IEEE 32-bit 1.175495e-38 3.4028235e+38
/* HELLO.C -- Hello, world */
#include <stdio.h>
Void main()
{
printf("Hello, worldn");
Getch();
}
Example of “C” Program
C programming Training in Ambala ! Batra Computer Centre
CONTACT US
SCO 15, Dayal Bagh,
Near Hanuman Mandir,
Ambala Cantt, Haryana
PIN CODE-133001
ADDRESS:
9729666670, 4000670PHNO:
EMAIL ID: info. jatinbatra@gmail.com
www.batracomputercentre.comWEBSITE:
BATRA COMPUTER
CENTRE ISO CERTIFIED
PHNO: 9729666670, 4000670

More Related Content

PPT
Introduction to c programming
PDF
88 c-programs
PPT
C# basics
PPTX
Introduction to C Language
PPTX
C language
PPTX
Programming in C Presentation upto FILE
PPT
C Language
Introduction to c programming
88 c-programs
C# basics
Introduction to C Language
C language
Programming in C Presentation upto FILE
C Language

What's hot (20)

PPT
C program
PPT
C the basic concepts
PPTX
Introduction to C# Programming
PDF
Features of c
PDF
Top C Language Interview Questions and Answer
DOCX
C notes
PDF
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
PPTX
Functions in c
PPT
1. over view and history of c
PPT
Lecture 1- History of C Programming
PPTX
C programming language tutorial
PPTX
PPTX
Conditional statement in c
PPTX
PPTX
Structure of C program
PPTX
Storage classes in c language
PDF
Unit ii chapter 2 Decision making and Branching in C
PPTX
Expression and Operartor In C Programming
PPTX
C programming interview questions
PPTX
Type casting
C program
C the basic concepts
Introduction to C# Programming
Features of c
Top C Language Interview Questions and Answer
C notes
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
Functions in c
1. over view and history of c
Lecture 1- History of C Programming
C programming language tutorial
Conditional statement in c
Structure of C program
Storage classes in c language
Unit ii chapter 2 Decision making and Branching in C
Expression and Operartor In C Programming
C programming interview questions
Type casting
Ad

Similar to C programming Training in Ambala ! Batra Computer Centre (20)

PPTX
C language ppt
PPT
history of c.ppt
PPTX
C Program basic concepts using c knoweledge
PPTX
Aniket tore
PPTX
unit2.pptx
PPTX
programming for problem solving in C and C++.pptx
PDF
Unit 2 introduction to c programming
PDF
C Programming Language Introduction and C Tokens.pdf
PPTX
Best_of_438343817-A-PPT-on-C-language.pptx
PPT
(Lect. 2 & 3) Introduction to C.ppt
PPTX
Introduction%20C.pptx
PPTX
C introduction
PPTX
UNIT 5 C PROGRAMMING, PROGRAM STRUCTURE
PPTX
C PROGRAMMING LANGUAGE.pptx
PPTX
unit 1 cpds.pptx
PDF
Introduction to Programming Fundamentals 3.pdf
PDF
Interview Questions For C Language
PPTX
Interview Questions For C Language .pptx
DOCX
PPTX
C language ppt
history of c.ppt
C Program basic concepts using c knoweledge
Aniket tore
unit2.pptx
programming for problem solving in C and C++.pptx
Unit 2 introduction to c programming
C Programming Language Introduction and C Tokens.pdf
Best_of_438343817-A-PPT-on-C-language.pptx
(Lect. 2 & 3) Introduction to C.ppt
Introduction%20C.pptx
C introduction
UNIT 5 C PROGRAMMING, PROGRAM STRUCTURE
C PROGRAMMING LANGUAGE.pptx
unit 1 cpds.pptx
Introduction to Programming Fundamentals 3.pdf
Interview Questions For C Language
Interview Questions For C Language .pptx
Ad

More from jatin batra (20)

PDF
Best SMO Training &Coaching in Ambala
PDF
Best HTML Training &Coaching in Ambala
PDF
Best SEO Training & Coaching in Ambala
PDF
Best Photoshop Training in Ambala
PDF
Best C Programming Training & Coaching in Ambala
PDF
BASIC COMPUTER TRAINING & COACHING CENTRE IN AMBALA CANTT
PPTX
Web Browser ! Batra Computer Centre
PPTX
Search Engine Training in Ambala ! Batra Computer Centre
PPTX
Networking Training in Ambala ! Batra Computer Centre
PPTX
SQL Training in Ambala ! BATRA COMPUTER CENTRE
PPTX
Networking ! BATRA COMPUTER CENTRE
PPTX
Ms Office 2010 Training in Ambala ! BATRA COMPUTER CENTRE
PPTX
Basic Computer Training Centre in Ambala ! BATRA COMPUTER CENTRE
PPTX
Corel Draw Training Institute in Ambala ! BATRA COMPUTER CENTRE
PPTX
Basic Computer Training Institute ! BATRA COMPUTER CENTRE
PPTX
HTML Training Institute in Ambala ! Batra Computer Centre
PPTX
Benefits of Web Browser ! Batra Computer Centre
PPTX
SEO Training in Ambala ! Batra Computer Centre
PPTX
Internet Training Centre in Ambala ! Batra Computer Centre
PPTX
Basic Computer Training Centre in Ambala ! Batra Computer Centre
Best SMO Training &Coaching in Ambala
Best HTML Training &Coaching in Ambala
Best SEO Training & Coaching in Ambala
Best Photoshop Training in Ambala
Best C Programming Training & Coaching in Ambala
BASIC COMPUTER TRAINING & COACHING CENTRE IN AMBALA CANTT
Web Browser ! Batra Computer Centre
Search Engine Training in Ambala ! Batra Computer Centre
Networking Training in Ambala ! Batra Computer Centre
SQL Training in Ambala ! BATRA COMPUTER CENTRE
Networking ! BATRA COMPUTER CENTRE
Ms Office 2010 Training in Ambala ! BATRA COMPUTER CENTRE
Basic Computer Training Centre in Ambala ! BATRA COMPUTER CENTRE
Corel Draw Training Institute in Ambala ! BATRA COMPUTER CENTRE
Basic Computer Training Institute ! BATRA COMPUTER CENTRE
HTML Training Institute in Ambala ! Batra Computer Centre
Benefits of Web Browser ! Batra Computer Centre
SEO Training in Ambala ! Batra Computer Centre
Internet Training Centre in Ambala ! Batra Computer Centre
Basic Computer Training Centre in Ambala ! Batra Computer Centre

Recently uploaded (20)

PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
RMMM.pdf make it easy to upload and study
PPTX
Cell Structure & Organelles in detailed.
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Computing-Curriculum for Schools in Ghana
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Pre independence Education in Inndia.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Lesson notes of climatology university.
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
Renaissance Architecture: A Journey from Faith to Humanism
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
GDM (1) (1).pptx small presentation for students
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Abdominal Access Techniques with Prof. Dr. R K Mishra
RMMM.pdf make it easy to upload and study
Cell Structure & Organelles in detailed.
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Computing-Curriculum for Schools in Ghana
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Pre independence Education in Inndia.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Lesson notes of climatology university.
Supply Chain Operations Speaking Notes -ICLT Program
102 student loan defaulters named and shamed – Is someone you know on the list?

C programming Training in Ambala ! Batra Computer Centre

  • 1. BATRA COMPUTER CENTRE ISO CERTIFIED PHNO: 9729666670, 4000670
  • 2. Introduction  C is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories.  Most of the programs of UNIX are written and run with the help of 'C'.  Many of the important ideas of 'c' stem are from BCPL by Martin Richards.  In 1972, Denies Ritchie at Bell Laboratories wrote C Language which caused a revolution in computing world .  From beginning C was intended to be useful for busy programmers to get things done easily because C is powerful, dominant and supple language.
  • 3. Why Name 'C' was given to this language?  Many of the ideas of C language were derived and taken from 'B' language.  BCPL and CPL are previous versions of 'B' language.  As many features came from B it was named as 'C'.
  • 4. ABOUT “C” o C is a structured programming language o C supports functions that enables easy maintainability of code, by breaking large file into smaller modules o Comments in C provides easy readability o C is a powerful language. o C programs built from • Variable and type declarations • Functions • Statements • Expressions  C programming language - Structured and disciplined approach to program design.
  • 6. Structure Of “C” Programs  Before going and reading the structure of C programs we need to have a basic knowledge of the following: 1. C's Character Set 2. C's Keywords 3. The General Structure of a 'C' Program 4. How To End A Statement 5. Free Format Language 6. Header Files & Library Functions
  • 7. C's Character Set C does not use every character set and key found on modern computers . The only characters that C - Language uses for its programs are as follows:  A-Z all alphabets  a-z all alphabets  0-9  # % & ! _ {} [] () $$$$ &&&& |  space . , : ; ' $ "  + - / * =
  • 8.  "Keywords" are words that have special meaning to the C compiler.  Their meaning cannot be changed at any instance.  Serve as basic building blocks for program statements.  All keywords are written in only lowercase. The keywords
  • 9. #include<stdio.h> #include<conio.h> void main() { -- other statements } Basic Structure Of “C” Programs Header Files Indicates Starting of Program Entry Point Of Program
  • 10.  The files that are specified in the include section is called as Header File.  These are precompiled files that has some functions defined in them.  We can call those functions in our program by supplying parameters.  Header file is given an extension .h .  C Source file is given an extension .c . Header files
  • 11.  This is the “Entry Point” of a program.  When a file is executed, the start point is the main function.  From main function the flow goes as per the programmers choice.  There may or may not be other functions written by user in a program.  Main function is compulsory for any C program. Main function
  • 12.  Type a program.  Save it.  Compile the program – This will generate an .exe file (executable)  Run the program (Actually the exe created out of compilation will run and not the .c file)  In different compiler we have different option for compiling and running. Running a ‘C’ Program
  • 13.  The smallest individual units in a C program are known as tokens. In a C source program, the basic element recognized by the compiler is the "token." A token is source-program text that the compiler does not break down into component elements.  C has 6 different types of tokens viz. 1. Keywords [e.g. float, int, while] 2. Identifiers [e.g. main, amount] 3. Constants [e.g. -25.6, 100] 4. Strings [e.g. “SMIT”, “year”] 5. Special Symbols [e.g. {, }, [, ] ] 6. Operators [e.g. +, -, *]  C - programs are written using these tokens and the general syntax. “C” language TOKENS Strin gs
  • 14. Keywords in Ansi “C” switch typedef union unsigned void volatile while long register return short signed sizeof static struct int double else enum etern float for goto if auto break case char const continue default do
  • 15.  They are programmer-chosen names to represent parts of the program: variables, functions, etc.  Cannot use C keywords as identifiers  Must begin with alpha character or _, followed by alpha, numeric, or _  Upper- and lower-case characters are important (case- sensitive)  Must consist of only letters, digits or underscore ( _ ).  Only first 31 characters are significant.  Must NOT contain spaces ( ). The Identifiers
  • 16.  Constants in C are the fixed values that do not change during the execution of a program. Constants CONSTANTS Numeric constants Character constants Integer Constants Real Constants Single Character Constants String Constants
  • 17. • Integer Constants – Refers to sequence of digits such as decimal integer, octal integer and hexadecimal integer. – Some of the examples are 112, 0551, 56579u, 0X2 etc. • Real Constants – The floating point constants such as 0.0083, -0.78, +67.89 etc. • Single Character Constants – A single char const contains a single character enclosed within pair of single quotes [ ‘ ’ ]. For example, ‘8’, ‘a’ , ‘i’ etc. • String Constants – A string constant is a sequence of characters enclosed in double quotes [ “ ” ]; For example, “0211”, “Stack Overflow” etc. Constants Examples
  • 18. DECLARATIONS  Constants and variables must be declared before they can be used.  A constant declaration specifies the type, the name and the value of the constant.  any attempt to alter the value of a variable defined  as constant results in an error message by the compiler  A variable declaration specifies the type, the name and possibly the initial value of the variable.  When you declare a constant or a variable, the compiler:  Reserves a memory location in which to store the value of the constant or variable.  Associates the name of the constant or variable with the memory location.
  • 19. A Variable is a data name that is used to store any data value. Variables are used to store values that can be changed during the program execution. Variables in C have the same meaning as variables in algebra. That is, they represent some unknown, or variable, value. x = a + b z + 2 = 3(y - 5) Remember that variables in algebra are represented by a single alphabetic character. What Are Variables in C?
  • 20. Naming Variables Variables in C may be given representations containing multiple characters. But there are rules for these representations. Variable names in C :  May only consist of letters, digits, and underscores  May be as long as you like, but only the first 31 characters are significant  May not begin with a number  May not be a C reserved word (keyword)  Should start with a letter or an underscore(_)  Can contain letters, numbers or underscore.  No other special characters are allowed including space.
  • 21. Case Sensitivity  C is a case sensitive language.  It matters whether an identifier, such as a variable name, is uppercase or lowercase.  Example: area Area AREA ArEa are all seen as different variables by the compiler.
  • 22. Declaring Variables  Before using a variable, you must give the compiler some information about the variable; i.e., you must declare it.  The declaration statement includes the data type of the variable.  Examples of variable declarations: int length ; float area ;  Variables are not automatically initialized. For example, after declaration int sum; the value of the variable sum can be anything (garbage).  Thus, it is good practice to initialize variables when they are declared.  Once a value has been placed in a variable it stays there until the program alters it.
  • 23. There are three classes of data types here:: Primitive data types int, float, double, char Aggregate OR derived data types Arrays come under this category Arrays can contain collection of int or float or char or double data User defined data types Structures and enum fall under this category. Data types in ‘ansi c’
  • 24. Data Types- different attributes Type Size Representation Minimum range Maximum range char, signed char 8 bits ASCII -128 127 unsigned char bool 8 bits ASCII 0 255 short, signed short 16 bits 2's complement -32768 32767 unsigned short 16 bits Binary 0 65535 int, signed int 16 bits 2's complement -32768 32767 unsigned int 16 bits Binary 0 65535 long, signed long 32 bits 2's complement -2,147,483,648 2,147,483,647 unsigned long 32 bits Binary 0 4,294,967,295 float 32 bits IEEE 32-bit 1.175495e-38 3.4028235e+38 double 32 bits IEEE 32-bit 1.175495e-38 3.4028235e+38 long double 32 bits IEEE 32-bit 1.175495e-38 3.4028235e+38
  • 25. /* HELLO.C -- Hello, world */ #include <stdio.h> Void main() { printf("Hello, worldn"); Getch(); } Example of “C” Program
  • 27. CONTACT US SCO 15, Dayal Bagh, Near Hanuman Mandir, Ambala Cantt, Haryana PIN CODE-133001 ADDRESS: 9729666670, 4000670PHNO: EMAIL ID: info. jatinbatra@gmail.com www.batracomputercentre.comWEBSITE:
  • 28. BATRA COMPUTER CENTRE ISO CERTIFIED PHNO: 9729666670, 4000670