SlideShare a Scribd company logo
1 of 32
Download to read offline
PAPER: INTRODUCTION PROGRAMMING LANGUAGE USING C
PAPER ID: 20105
PAPER CODE: BCA 105
DR. VARUN TIWARI
(ASSOCIATE PROFESSOR)
(DEPARTMENT OF COMPUTER SCIENCE)
BOSCO TECHNICAL TRAINING SOCIETY,
DON BOSCO TECHNICAL SCHOOL, OKHLA ROAD , NEW DELHI
C BASICS
OBJECTIVES
In this unit you will learn:
1. To understand about C Language.
2. To learn about the Characteristics of C
3. To use of C Language.
4. To understand about the Character sets in C
5. To understand to Installation of C in PC
6. To write simple computer program in C
7. To use input and output statements in C
8. To learn about the identifier and keyword in C
9. To learn about the Constants in C
10. To understand about the array and variables.
11. To learn about the declaration of identifier , keyword , constant , data types and variables in C
INTRODUCTION ABOUT C LANGUAGE
1. In 1970 Dennis Ritchie created a new language called C. It is superseded of old
programming language was called B.
2. It is developed at AT & T’s Bell Laboratories of USA in 1972.
3. C is powerful procedural based language.
4. It is very simple , reliable and easy to use.
5. Basically c was designed for the operating system.
6. It is supporting structural programming.
7. Unix system development started in 1969 and it’s code re-written in C language in c in 1972.
8. Oracle database development started in 1977 and it’s code was re-written in C language
in 1983.
9. In 1985 window 1.0 was released and it’s kernel was re-written in C Language.
INTRODUCTION ABOUT C LANGUAGE
10. Linux Kernel started in 1991 and was written in C Language.
11. It is Middle level language. There are three types of language (a) Low Level
Language Ex: Machine code and Assembly Language (b) Middle Level Language
Ex: c and c++ (c) High Level Language Ex: Java , Cobol , Pascal , Fortran and Python
etc.
12. In 1980, Bjarne Stroustrup started working on a new language, called "C with
Classes”. This language included some unique features of the C language, hence it
was known as C ++.
13. American National Standards Institute established a committee in 1983. The goal of
this committee was to produce “an unambiguous and machine-independent
definition of the language C‘’. The result is the ANSI standard for C.
CHARACTERISTICS OF C LANGUAGE
• Simple.
• Robust and Reliable Language.
• It is easily install and transportable.
• It is easy to use.
• C language package/exe file is very small in Size.
• It is Structural Language.
• It is use of Pointer for allocating a memory , pointer to array , structure etc.
• Recursion.
• It is Machine Independent.
• It is Middle Level Language.
USE OF C LANGUAGE
• To design a Database System
• To design Graphics Packages (GUI Platform)
• To design a Word Processor
• To design a Spreadsheet
• To design Embedded devices code ex. Microwave Oven , Washing Machine
and Digital Camera etc.
• To design a device driver code.
• To design gaming framework code in c
• Operating System Development
• Compiler and Assembler Development
CHARACTER SET IN C LANGUAGE
A character set denotes any Alphabets, digits , Special Characters , White
space characters and escape sequence characters used to represent
information. Tables shows the valid alphabets , digits , special , white space
characters and escape sequence characters. There are two categories
available in C for Character set.
1. Basis Character Set:
a. Alphabets
b. Digits
c. Special Characters
d. White Space
CHARACTER SET IN C LANGUAGE
2. Task Performance Character Set
a. Escape Sequence
1. Basis Character Set:
a. Alphabets
a. Upper Case : A to Z
b. Lower Case : a to z
b. Digits
a. 0,1,2,3,4,5,6,7,8,9
CHARACTER SET IN C LANGUAGE
c. Special Characters:
Special
Character
Meaning Special
Character
Meaning
~ Tilde ( Left Parenthesis
+ Plus Sign ) Right Parenthesis
% Percent Sign ‘ Apostrophe
< Less Than ; Semicolon
| Vertical Bar : Colon
@ At Symbol [ Left Bracket
_ Under Score ] Right Bracket
# Number Sign (Hash
Symbol)
“ Quotation Marks
- Minus Sign ! Exclamation Mark
= Equal To , Comma
> Greater Than . Dot Operator
^ Caret { Left Flower Brace
& Ampersand } Right Flower Brace
* Asterisk ? Question Mark
$ Dollar Sign
/ Slash
CHARACTER SET IN C LANGUAGE
d. White Space Characters:
White Space
Character
Meaning White Space
Character
Meaning
b Blank Space  Back Space
v Vertical Tab ” Double Quote
f Form Feed 0 Null
t Horizontal Tab ’ Single Quote
r Carriage Return ? Question Mark
n New Line a Alarm (bell)
CHARACTER SET IN C LANGUAGE
2. Task Performance Character Set
a. Escape Sequence (Backslash Characters)
Character Sequence Ascii
Value
Escape Sequence Result
Null 0 0 Null
Alarm (bell) 7 a Beep Sound
Back space 8 b Moves previous position
Horizontal tab 9 t Moves next horizontal tab
New line 10 n Moves next Line
Vertical tab 11 v Moves next vertical tab
Form feed page 12 f Moves initial position of next
Carriage return 13 r Moves beginning of the line
Double quote 34 " Present Double quotes
Single quote 39 ' Present Apostrophe
Question mark 63 ? Present Question Mark
Back slash 92  Present back slash
Octal number 0
Hexadecimal number x
ASCII TABLE CHARACTER SET IN C
ASCII CODE PROGRAM
INSTALLATION OF C LANGUAGE IN PC
1. Download this Software from
https://drive.google.com/drive/u/1/folders/1CXc3_YT1StfM-yQ6qiR7UhkgFOhJKssw
2. After Downloading this software then Extract this Software via some Zip Software or Window 10 Extractor.
3. After that select Setup file and press double click and install this software on your PC.
4. After completing installation of Software then follow next slide for making a new program in turbo c.
5. If you want to create a new program then select a file menu  select New and click.
6. After writing a new program then save this program by using F2 key.( for saving purpose).
7. After saving this program , compile this program by using Alt + F9 key.
8. After compiling process now execute this program by using ctrl + F9 Key.
9. In the next slide, I have a complete brief about this program.
TOKENS
• There are six types of Tokens: Identifiers , Keywords , Constants , String Literals
,Operators and separators. Blanks, horizontal and vertical tabs, newlines,
form feeds and comments as described below (collectively, ``white space'')
are ignored except as they separate tokens. Some white space is required to
separate otherwise adjacent identifiers, keywords, and constants.
IDENTIFIER , KEYWORD , VARIABLES AND CONSTANTS IN C
Identifier: An identifier is used to identify elements of a program. Ex. Name of the
variable , function name , array , structure and union etc. There are some rules
under the identifier like:
1. The first character of an identifier should be either character or underscore ex.
Ab , A , _Abc_ , temp_ etc.
2. The first character should not be a digit Ex. 2abc.
3. Identifier are case sensitive. Ex: A or a both are different.
4. Comma and blank spaces do not fall inside the identifier.
5. Keyword can not use as an identifier.
6. Whitespace character can not use as an identifier.
7. The length of identifier should not be more than 31.
8. Identifier should be a meaningful and easy to use.
Example :
1. Abc , _abcd_ , Abc_bcd , a233rrr , A , a // Valid Identifier
2. 2kkkk , abv bbb, bbbb , ,uuoo , add#r // Not a valid Identifier
IDENTIFIER , KEYWORD , VARIABLES AND CONSTANTS IN C
Keyword: Some identifiers are reserved for the use as a keywords and may not be used
otherwise. There are 32 keywords available in c language.
1. Auto: This is Storage Class Specifier in C. This is called automatic.
2. Break : This is used for break in any statement in C.
3. Double: Double is used to declare decimal number in c.
4. Int : Declare numeric variable in C.
5. Struct: It is a user defined data types. It is to represent a single record.
6. Else: It is a statement. It is return as true/false.
7. Long: It is numeric data type. But bigger in size int.
8. Switch: It is a statement. It is used for checking multiple condition.
9. Case: list of value passing in switch. Each value is called a case.
10. Enum: It is user defined data types. It is consist of integral constants.
11. Register: It is storage class specifier.
IDENTIFIER , KEYWORD , VARIABLES AND CONSTANTS IN C
12. typedef: this keyword is used to redefine the name of an already existing variable.
13. Char: defined char type variable.
14. Extern: It is storage class specifier. It is used to extend visibility of function or variable.
15. Return: A return statement can return a value to the calling function
16. Union: It allows to store different data types in same memory location.
17. Const: const variable can be initialized once only. The default value of this variable is 0.
18. Float: It is used for decimal number but less than in size float.
19. Short: It is data type same as int.
20. Unsigned: it can only represent non-negative values.
21. Continue: The continue statement skips the current iteration of the loop and continues
with the next iteration.
22. For: It is a loop . It is used to repeat a block of code.
23. Signed: It can represent both positive and negative values.
IDENTIFIER , KEYWORD, VARIABLES AND CONSTANTS IN C
24. Void: it indicates that the function does not return a value.
25. Default: The default statement is executed if no case constant-expression value is equal
to the value of expression .
26. Goto: It is called Jump Statement. It is used to jump one statement to other statement.
27. Size of: It is used to find the size of any data types.
28. Volatile: volatile keyword is qualifier that prevents from compiler optimization and tells to
compiler that value can change without any action taken by code.
29. Do: do is used with the help of while condition in C so that is called do while.
30. If : it is used to check one or more condition if condition is true then this statement run.
31. Static: static variable scope is throughout the program.
32 while: While loop is also known as a pre-tested loop.
IDENTIFIER , KEYWORD, VARIABLES AND CONSTANTS IN C
Variables: A variable is used to store a value or it can hold only the same type of
constant. There are two types of variables: 1. Internal Variables (Local Variables) 2.
External Variables (Global Variables). There are some rules for declaring a variable
in C.
1. The combination of variable alphabets ,digit or underscore. The length of
variable up to 247 characters.
2. The first character of variable name must be alphabets or underscore (_).
3. Variable are case sensitive. Ex: A or a both are different.
4. No Commas and blank spaces allows in variable declaration.
5. C is a strongly typed language. This means that the variable type cannot be
changed once it is declared. Ex. Int p=10; //ok p =19.8 // error
6. No Special Symbols can be used (rather than _) in a variable names.
IDENTIFIER , KEYWORD, VARIABLES AND CONSTANTS IN C
Constants: Constant is an entity does not change where as variable is an entity that
may change. There are two major categories of constant:
1. Primary Constants : Integer , Real , octal & hexadecimal , string , Character.
2. Secondary Constants : Array , Pointer , Structure , union ,Enumeration etc.
Constant Example
Integer constants
int (11, 44,-23.-55)
unsigned int (1233u, 2123U)
long int (333,444) , long long int (888,99,55)
Real or Floating point constants
float (12.44)
doule (556.779)
Octal constant int ( 017) /* start with 0 */
Hexadecimal constant int (0x66) /*start with 0x*/
character constant char ( ‘M’,’N’,’O’)
String Constant Char (“hellllo” , “how”)
RULES OF CONSTANT
For Integer constant:
1. An integer constant must have at least one digit.
2. It must not have decimal point.
3. No commas or blank space are allowed.
For Real Constant:
1. An real constant must have at least one digit.
2. It must have a decimal point.
3. It either positive or negative. Default sign is positive.
4. No commas or blanks are allowed.
RULES OF CONSTANT
For Character and String constant:
1. A character constant is a single alphabet , a single digit or single special symbol
enclosed with in single inverted commas.
2. A string constant is a multiple alphabet, a multiple digit or multiple special
symbol enclosed with in double quotes.
Symbolic Constant :
It is a special constant that is represent a symbol in our program. Example #define
Ex- #include<conio.h>
#include<stdio.h>
#define op 34.56
ARRAY
Array is a collection of Similar data type. It is used to store multiple data in a single variable.
Declaration of array:
#include<conio.h>
#include<stdio.h>
Void main()
{
int a [5]; // this is declaration of array
int p;
for (p=1;p<=10;p++)
{
scanf(“%d”,&a[p]);
}
for (p=1;p<=5;p++)
{
printf(“Output is -: %d”,a[p]);
}
getch();
}
DATATYPES IN C
Datatype: Datatype represent a type of data which is store under the variable and used
for the function declaration. It tells the compiler how the programmer plan to use the data. It
provides a set of values from which an expression (i.e. variable, function, etc.) may take its
values. There are different types of data used in c language. Ex:
1. Preemptive Datatype
a. Integer
b. Character
c. Floating
2. Non-Preemptive Datatype
a. Array
b. Function
c. Pointer
d. Structure
e. Enum
f. union
Datatypes Description variable Conversion / specifier Range of Datatype
Char Character or string %c (char) , %s (string) -128 to 127
int Integer %d -32768 to 32767
short or short int Short integer %d -32768 to 32767
long
long int
Long integer %d
%ld
-2147483648 to
2147483648
unsigned char Unsigned character %u 0 to 255
unsigned int Unsigned int %u 0 to 65535
unsigned short Unsigned short integer %u 0 to 65535
unsigned long Unsigned long integer %u 0 to 4294967295
float Single – precision floating point Signed floating-point value
in E-notation (%e) , Signed
floating-point value (%f)
+ - 3.4 X 10 -38 to
+ - 3.4 X 10 38
double / long float Double precision floating point %f , %lf + - 1.7 X 10 -308 to
+ - 1.7 X 10 308
Signed decimal integer Signed decimal integer %i
Unsigned octal (base 8)
int
Octal integer %o 2 bytes
Unsigned hexadecimal
(base 16) int
Hexadecimal integer %x 2 bytes
%% printf("Output is %d %%”,8); (percent character)
THANK YOU

More Related Content

What's hot

POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
(2) cpp imperative programming
(2) cpp imperative programming(2) cpp imperative programming
(2) cpp imperative programmingNico Ludwig
 
Top C Language Interview Questions and Answer
Top C Language Interview Questions and AnswerTop C Language Interview Questions and Answer
Top C Language Interview Questions and AnswerVineet Kumar Saini
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answerVasuki Ramasamy
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance levelsajjad ali khan
 
FNT Software Solutions Pvt Ltd Placement Papers - PHP Technologies
FNT Software Solutions Pvt Ltd Placement Papers - PHP TechnologiesFNT Software Solutions Pvt Ltd Placement Papers - PHP Technologies
FNT Software Solutions Pvt Ltd Placement Papers - PHP Technologiesfntsofttech
 
Features of c language 1
Features of c language 1Features of c language 1
Features of c language 1srmohan06
 
C programmimng basic.ppt
C programmimng basic.pptC programmimng basic.ppt
C programmimng basic.pptASIT Education
 
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit orderMalikireddy Bramhananda Reddy
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii pptJStalinAsstProfessor
 

What's hot (20)

Tokens_C
Tokens_CTokens_C
Tokens_C
 
C notes
C notesC notes
C notes
 
C programming
C programmingC programming
C programming
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
(2) cpp imperative programming
(2) cpp imperative programming(2) cpp imperative programming
(2) cpp imperative programming
 
Top C Language Interview Questions and Answer
Top C Language Interview Questions and AnswerTop C Language Interview Questions and Answer
Top C Language Interview Questions and Answer
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
 
Tutorial csharp
Tutorial csharpTutorial csharp
Tutorial csharp
 
C languaGE UNIT-1
C languaGE UNIT-1C languaGE UNIT-1
C languaGE UNIT-1
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 
FNT Software Solutions Pvt Ltd Placement Papers - PHP Technologies
FNT Software Solutions Pvt Ltd Placement Papers - PHP TechnologiesFNT Software Solutions Pvt Ltd Placement Papers - PHP Technologies
FNT Software Solutions Pvt Ltd Placement Papers - PHP Technologies
 
Features of c language 1
Features of c language 1Features of c language 1
Features of c language 1
 
Basic c
Basic cBasic c
Basic c
 
C programmimng basic.ppt
C programmimng basic.pptC programmimng basic.ppt
C programmimng basic.ppt
 
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
 
Introduction of C++ By Pawan Thakur
Introduction of C++ By Pawan ThakurIntroduction of C++ By Pawan Thakur
Introduction of C++ By Pawan Thakur
 
Overview of c#
Overview of c#Overview of c#
Overview of c#
 

Similar to C programming Basics

Similar to C programming Basics (20)

C programming.pdf
C programming.pdfC programming.pdf
C programming.pdf
 
Copy of UNIT 2 -- Basics Of Programming.pptx
Copy of UNIT 2 -- Basics Of Programming.pptxCopy of UNIT 2 -- Basics Of Programming.pptx
Copy of UNIT 2 -- Basics Of Programming.pptx
 
UNIT 1 NOTES.docx
UNIT 1 NOTES.docxUNIT 1 NOTES.docx
UNIT 1 NOTES.docx
 
SPC Unit 2
SPC Unit 2SPC Unit 2
SPC Unit 2
 
Chapter 3(1)
Chapter 3(1)Chapter 3(1)
Chapter 3(1)
 
What is turbo c and how it works
What is turbo c and how it worksWhat is turbo c and how it works
What is turbo c and how it works
 
The smartpath information systems c pro
The smartpath information systems c proThe smartpath information systems c pro
The smartpath information systems c pro
 
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)
 
C programming notes
C programming notesC programming notes
C programming notes
 
c programming session 1.pptx
c programming session 1.pptxc programming session 1.pptx
c programming session 1.pptx
 
Unit4
Unit4Unit4
Unit4
 
C programming notes.pdf
C programming notes.pdfC programming notes.pdf
C programming notes.pdf
 
Msc prev completed
Msc prev completedMsc prev completed
Msc prev completed
 
Msc prev updated
Msc prev updatedMsc prev updated
Msc prev updated
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshuunit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
 
2.Overview of C language.pptx
2.Overview of C language.pptx2.Overview of C language.pptx
2.Overview of C language.pptx
 
Chaptr 1
Chaptr 1Chaptr 1
Chaptr 1
 
C programming
C programmingC programming
C programming
 
C language
C languageC language
C language
 

More from Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)

More from Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi) (20)

String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
 
C Structure and Union in C
C Structure and Union in CC Structure and Union in C
C Structure and Union in C
 
Preprocessor Directive in C
Preprocessor Directive in CPreprocessor Directive in C
Preprocessor Directive in C
 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C Programming
 
Bit field enum and command line arguments
Bit field enum and command line argumentsBit field enum and command line arguments
Bit field enum and command line arguments
 
Pointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory AllocationPointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory Allocation
 
Array in C
Array in CArray in C
Array in C
 
C storage class
C storage classC storage class
C storage class
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)
 
C Operators
C OperatorsC Operators
C Operators
 
Software Development Skills and SDLC
Software Development Skills and SDLCSoftware Development Skills and SDLC
Software Development Skills and SDLC
 
Mobile commerce
Mobile commerceMobile commerce
Mobile commerce
 
E commerce application
E commerce applicationE commerce application
E commerce application
 
Data normalization
Data normalizationData normalization
Data normalization
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 
Security issue in e commerce
Security issue in e commerceSecurity issue in e commerce
Security issue in e commerce
 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
Database connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwariDatabase connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwari
 

Recently uploaded

MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
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
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
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
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

C programming Basics

  • 1. PAPER: INTRODUCTION PROGRAMMING LANGUAGE USING C PAPER ID: 20105 PAPER CODE: BCA 105 DR. VARUN TIWARI (ASSOCIATE PROFESSOR) (DEPARTMENT OF COMPUTER SCIENCE) BOSCO TECHNICAL TRAINING SOCIETY, DON BOSCO TECHNICAL SCHOOL, OKHLA ROAD , NEW DELHI
  • 3. OBJECTIVES In this unit you will learn: 1. To understand about C Language. 2. To learn about the Characteristics of C 3. To use of C Language. 4. To understand about the Character sets in C 5. To understand to Installation of C in PC 6. To write simple computer program in C 7. To use input and output statements in C 8. To learn about the identifier and keyword in C 9. To learn about the Constants in C 10. To understand about the array and variables. 11. To learn about the declaration of identifier , keyword , constant , data types and variables in C
  • 4. INTRODUCTION ABOUT C LANGUAGE 1. In 1970 Dennis Ritchie created a new language called C. It is superseded of old programming language was called B. 2. It is developed at AT & T’s Bell Laboratories of USA in 1972. 3. C is powerful procedural based language. 4. It is very simple , reliable and easy to use. 5. Basically c was designed for the operating system. 6. It is supporting structural programming. 7. Unix system development started in 1969 and it’s code re-written in C language in c in 1972. 8. Oracle database development started in 1977 and it’s code was re-written in C language in 1983. 9. In 1985 window 1.0 was released and it’s kernel was re-written in C Language.
  • 5. INTRODUCTION ABOUT C LANGUAGE 10. Linux Kernel started in 1991 and was written in C Language. 11. It is Middle level language. There are three types of language (a) Low Level Language Ex: Machine code and Assembly Language (b) Middle Level Language Ex: c and c++ (c) High Level Language Ex: Java , Cobol , Pascal , Fortran and Python etc. 12. In 1980, Bjarne Stroustrup started working on a new language, called "C with Classes”. This language included some unique features of the C language, hence it was known as C ++. 13. American National Standards Institute established a committee in 1983. The goal of this committee was to produce “an unambiguous and machine-independent definition of the language C‘’. The result is the ANSI standard for C.
  • 6. CHARACTERISTICS OF C LANGUAGE • Simple. • Robust and Reliable Language. • It is easily install and transportable. • It is easy to use. • C language package/exe file is very small in Size. • It is Structural Language. • It is use of Pointer for allocating a memory , pointer to array , structure etc. • Recursion. • It is Machine Independent. • It is Middle Level Language.
  • 7. USE OF C LANGUAGE • To design a Database System • To design Graphics Packages (GUI Platform) • To design a Word Processor • To design a Spreadsheet • To design Embedded devices code ex. Microwave Oven , Washing Machine and Digital Camera etc. • To design a device driver code. • To design gaming framework code in c • Operating System Development • Compiler and Assembler Development
  • 8. CHARACTER SET IN C LANGUAGE A character set denotes any Alphabets, digits , Special Characters , White space characters and escape sequence characters used to represent information. Tables shows the valid alphabets , digits , special , white space characters and escape sequence characters. There are two categories available in C for Character set. 1. Basis Character Set: a. Alphabets b. Digits c. Special Characters d. White Space
  • 9. CHARACTER SET IN C LANGUAGE 2. Task Performance Character Set a. Escape Sequence 1. Basis Character Set: a. Alphabets a. Upper Case : A to Z b. Lower Case : a to z b. Digits a. 0,1,2,3,4,5,6,7,8,9
  • 10. CHARACTER SET IN C LANGUAGE c. Special Characters: Special Character Meaning Special Character Meaning ~ Tilde ( Left Parenthesis + Plus Sign ) Right Parenthesis % Percent Sign ‘ Apostrophe < Less Than ; Semicolon | Vertical Bar : Colon @ At Symbol [ Left Bracket _ Under Score ] Right Bracket # Number Sign (Hash Symbol) “ Quotation Marks - Minus Sign ! Exclamation Mark = Equal To , Comma > Greater Than . Dot Operator ^ Caret { Left Flower Brace & Ampersand } Right Flower Brace * Asterisk ? Question Mark $ Dollar Sign / Slash
  • 11. CHARACTER SET IN C LANGUAGE d. White Space Characters: White Space Character Meaning White Space Character Meaning b Blank Space Back Space v Vertical Tab ” Double Quote f Form Feed 0 Null t Horizontal Tab ’ Single Quote r Carriage Return ? Question Mark n New Line a Alarm (bell)
  • 12. CHARACTER SET IN C LANGUAGE 2. Task Performance Character Set a. Escape Sequence (Backslash Characters) Character Sequence Ascii Value Escape Sequence Result Null 0 0 Null Alarm (bell) 7 a Beep Sound Back space 8 b Moves previous position Horizontal tab 9 t Moves next horizontal tab New line 10 n Moves next Line Vertical tab 11 v Moves next vertical tab Form feed page 12 f Moves initial position of next Carriage return 13 r Moves beginning of the line Double quote 34 " Present Double quotes Single quote 39 ' Present Apostrophe Question mark 63 ? Present Question Mark Back slash 92 Present back slash Octal number 0 Hexadecimal number x
  • 15. INSTALLATION OF C LANGUAGE IN PC 1. Download this Software from https://drive.google.com/drive/u/1/folders/1CXc3_YT1StfM-yQ6qiR7UhkgFOhJKssw 2. After Downloading this software then Extract this Software via some Zip Software or Window 10 Extractor. 3. After that select Setup file and press double click and install this software on your PC. 4. After completing installation of Software then follow next slide for making a new program in turbo c. 5. If you want to create a new program then select a file menu  select New and click. 6. After writing a new program then save this program by using F2 key.( for saving purpose). 7. After saving this program , compile this program by using Alt + F9 key. 8. After compiling process now execute this program by using ctrl + F9 Key. 9. In the next slide, I have a complete brief about this program.
  • 16.
  • 17.
  • 18. TOKENS • There are six types of Tokens: Identifiers , Keywords , Constants , String Literals ,Operators and separators. Blanks, horizontal and vertical tabs, newlines, form feeds and comments as described below (collectively, ``white space'') are ignored except as they separate tokens. Some white space is required to separate otherwise adjacent identifiers, keywords, and constants.
  • 19. IDENTIFIER , KEYWORD , VARIABLES AND CONSTANTS IN C Identifier: An identifier is used to identify elements of a program. Ex. Name of the variable , function name , array , structure and union etc. There are some rules under the identifier like: 1. The first character of an identifier should be either character or underscore ex. Ab , A , _Abc_ , temp_ etc. 2. The first character should not be a digit Ex. 2abc. 3. Identifier are case sensitive. Ex: A or a both are different. 4. Comma and blank spaces do not fall inside the identifier. 5. Keyword can not use as an identifier. 6. Whitespace character can not use as an identifier.
  • 20. 7. The length of identifier should not be more than 31. 8. Identifier should be a meaningful and easy to use. Example : 1. Abc , _abcd_ , Abc_bcd , a233rrr , A , a // Valid Identifier 2. 2kkkk , abv bbb, bbbb , ,uuoo , add#r // Not a valid Identifier
  • 21. IDENTIFIER , KEYWORD , VARIABLES AND CONSTANTS IN C Keyword: Some identifiers are reserved for the use as a keywords and may not be used otherwise. There are 32 keywords available in c language. 1. Auto: This is Storage Class Specifier in C. This is called automatic. 2. Break : This is used for break in any statement in C. 3. Double: Double is used to declare decimal number in c. 4. Int : Declare numeric variable in C. 5. Struct: It is a user defined data types. It is to represent a single record. 6. Else: It is a statement. It is return as true/false. 7. Long: It is numeric data type. But bigger in size int. 8. Switch: It is a statement. It is used for checking multiple condition. 9. Case: list of value passing in switch. Each value is called a case. 10. Enum: It is user defined data types. It is consist of integral constants. 11. Register: It is storage class specifier.
  • 22. IDENTIFIER , KEYWORD , VARIABLES AND CONSTANTS IN C 12. typedef: this keyword is used to redefine the name of an already existing variable. 13. Char: defined char type variable. 14. Extern: It is storage class specifier. It is used to extend visibility of function or variable. 15. Return: A return statement can return a value to the calling function 16. Union: It allows to store different data types in same memory location. 17. Const: const variable can be initialized once only. The default value of this variable is 0. 18. Float: It is used for decimal number but less than in size float. 19. Short: It is data type same as int. 20. Unsigned: it can only represent non-negative values. 21. Continue: The continue statement skips the current iteration of the loop and continues with the next iteration. 22. For: It is a loop . It is used to repeat a block of code. 23. Signed: It can represent both positive and negative values.
  • 23. IDENTIFIER , KEYWORD, VARIABLES AND CONSTANTS IN C 24. Void: it indicates that the function does not return a value. 25. Default: The default statement is executed if no case constant-expression value is equal to the value of expression . 26. Goto: It is called Jump Statement. It is used to jump one statement to other statement. 27. Size of: It is used to find the size of any data types. 28. Volatile: volatile keyword is qualifier that prevents from compiler optimization and tells to compiler that value can change without any action taken by code. 29. Do: do is used with the help of while condition in C so that is called do while. 30. If : it is used to check one or more condition if condition is true then this statement run. 31. Static: static variable scope is throughout the program. 32 while: While loop is also known as a pre-tested loop.
  • 24. IDENTIFIER , KEYWORD, VARIABLES AND CONSTANTS IN C Variables: A variable is used to store a value or it can hold only the same type of constant. There are two types of variables: 1. Internal Variables (Local Variables) 2. External Variables (Global Variables). There are some rules for declaring a variable in C. 1. The combination of variable alphabets ,digit or underscore. The length of variable up to 247 characters. 2. The first character of variable name must be alphabets or underscore (_). 3. Variable are case sensitive. Ex: A or a both are different. 4. No Commas and blank spaces allows in variable declaration. 5. C is a strongly typed language. This means that the variable type cannot be changed once it is declared. Ex. Int p=10; //ok p =19.8 // error 6. No Special Symbols can be used (rather than _) in a variable names.
  • 25. IDENTIFIER , KEYWORD, VARIABLES AND CONSTANTS IN C Constants: Constant is an entity does not change where as variable is an entity that may change. There are two major categories of constant: 1. Primary Constants : Integer , Real , octal & hexadecimal , string , Character. 2. Secondary Constants : Array , Pointer , Structure , union ,Enumeration etc. Constant Example Integer constants int (11, 44,-23.-55) unsigned int (1233u, 2123U) long int (333,444) , long long int (888,99,55) Real or Floating point constants float (12.44) doule (556.779) Octal constant int ( 017) /* start with 0 */ Hexadecimal constant int (0x66) /*start with 0x*/ character constant char ( ‘M’,’N’,’O’) String Constant Char (“hellllo” , “how”)
  • 26. RULES OF CONSTANT For Integer constant: 1. An integer constant must have at least one digit. 2. It must not have decimal point. 3. No commas or blank space are allowed. For Real Constant: 1. An real constant must have at least one digit. 2. It must have a decimal point. 3. It either positive or negative. Default sign is positive. 4. No commas or blanks are allowed.
  • 27. RULES OF CONSTANT For Character and String constant: 1. A character constant is a single alphabet , a single digit or single special symbol enclosed with in single inverted commas. 2. A string constant is a multiple alphabet, a multiple digit or multiple special symbol enclosed with in double quotes. Symbolic Constant : It is a special constant that is represent a symbol in our program. Example #define Ex- #include<conio.h> #include<stdio.h> #define op 34.56
  • 28.
  • 29. ARRAY Array is a collection of Similar data type. It is used to store multiple data in a single variable. Declaration of array: #include<conio.h> #include<stdio.h> Void main() { int a [5]; // this is declaration of array int p; for (p=1;p<=10;p++) { scanf(“%d”,&a[p]); } for (p=1;p<=5;p++) { printf(“Output is -: %d”,a[p]); } getch(); }
  • 30. DATATYPES IN C Datatype: Datatype represent a type of data which is store under the variable and used for the function declaration. It tells the compiler how the programmer plan to use the data. It provides a set of values from which an expression (i.e. variable, function, etc.) may take its values. There are different types of data used in c language. Ex: 1. Preemptive Datatype a. Integer b. Character c. Floating 2. Non-Preemptive Datatype a. Array b. Function c. Pointer d. Structure e. Enum f. union
  • 31. Datatypes Description variable Conversion / specifier Range of Datatype Char Character or string %c (char) , %s (string) -128 to 127 int Integer %d -32768 to 32767 short or short int Short integer %d -32768 to 32767 long long int Long integer %d %ld -2147483648 to 2147483648 unsigned char Unsigned character %u 0 to 255 unsigned int Unsigned int %u 0 to 65535 unsigned short Unsigned short integer %u 0 to 65535 unsigned long Unsigned long integer %u 0 to 4294967295 float Single – precision floating point Signed floating-point value in E-notation (%e) , Signed floating-point value (%f) + - 3.4 X 10 -38 to + - 3.4 X 10 38 double / long float Double precision floating point %f , %lf + - 1.7 X 10 -308 to + - 1.7 X 10 308 Signed decimal integer Signed decimal integer %i Unsigned octal (base 8) int Octal integer %o 2 bytes Unsigned hexadecimal (base 16) int Hexadecimal integer %x 2 bytes %% printf("Output is %d %%”,8); (percent character)