SlideShare a Scribd company logo
BY REHAN IJAZ
04- Getting Started with C
BY REHAN IJAZ
C's Character Set
C does not use, nor requires the use of, every character found on a modern computer
keyboard. The use of most of this set of characters will be discussed throughout the course. The
only characters required by the C Programming Language are as follows:
character:- It denotes any alphabet, digit or special symbol used to represent information.
Use:- These characters can be combined to form variables. C uses variables, operators,
keywords and expressions as building blocks to form a basic C program.
Character set:- The character set is the fundamental raw material of any language and they are
used to represent information. Like natural languages, computer language will also have well
defined character set, which is useful to build the programs.
The characters in C are grouped into the following two categories:
1. Source characterset
a. Alphabets
b. Digits
c. Special Characters
d. White Spaces
2. Execution characterset
a. Escape Sequence
1. Source character set
ALPHABETS
Uppercase letters A-Z
Lowercase letters a-z
DIGITS 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
SPECIAL CHARACTERS
WHITESPACE CHARACTERS
b blank space t horizontal tab v vertical tab r carriage return f form feed n new line
BY REHAN IJAZ
 Back slash ’ Single quote " Double quote ? Question mark 0 Null a Alarm (bell)
2. Execution Character Set
Certain ASCII characters are unprintable, which means they are not displayed on the screen or
printer. Those characters perform other functions aside from displaying text. Examples are
backspacing or moving to a newline .
They are used in output statements. Escape sequence usually consists of a backslash and a
letter or a combination of digits. An escape sequence is considered as a single character but a
valid character constant.
These are employed at the time of execution of the program. Execution characters set are
always represented by a backslash () followed by a character. Note that each one of character
constants represents one character, although they consist of two characters. These characters
combinations are called as escape sequence.
Escape Sequence
Invalid Sequence
#include <stdio.h>
int main()
{
printf("Hello,
world!");
}
Correct Sequence
#include <stdio.h>
int main()
{
printf("Hello,nworld!");
}
BY REHAN IJAZ
More Escape Sequences
 Null 0 Null
 Alarm (bell) a Beep Sound
 Back space b Moves previous position
 Horizontal tab t Moves next horizontal tab
 New line n Moves next Line
 Vertical tab v Moves next vertical tab
 Form feed f Moves initial position of next page
 Carriage return r Moves beginning of the line
 Double quote " Present Double quotes
 Single quote ' Present Apostrophe
 Question mark ? Present Question Mark
 Back slash  Present back slash
BY REHAN IJAZ
C’s Variable
 C variable is a named location in a memory where a program can manipulate the data.
This location is used to hold the value of the variable.
 The value of the C variable may get change in the program.
 C variable might be belonging to any of the data type like int, float, char etc.
Rules for naming C variable:
1. Variable name must begin with letter or underscore.
2. Variable names are case sensitive
3. They can be constructed with digits, letters.
4. No special symbols are allowed other than underscore.
5. sum, height, _value are some examples for variable name
Declaring & initializing C variable:
 Variables should be declared in the C program before to use.
 Memory space is not allocated for a variable while declaration. It happens only on
variable definition.
 Variable initialization means assigning a value to the variable.
S.No Type Syntax Example
1 Variable
declaration
data_type variable_name; int x, y, z; char flat, ch;
2 Variable
initialization
data_type variable_name =
value;
int x = 50, y = 30; char flag
= ‘x’, ch=’l’;
Variable types
There are three types of variables in C program They are,
1. Local variable
2. Global variable
3. Environment variable
BY REHAN IJAZ
1. Example program for local variable in C:
 The scope of local variables will be within the function only.
 These variables are declared within the function and can’t be accessed outside the
function.
 In the below example, m and n variables are having scope within the main function only.
These are not visible to test function.
 Like wise, a and b variables are having scope within the test function only. These are not
visible to main function.
#include<stdio.h>
void test();
int main()
{
int m = 22, n = 44;
printf(“nvalues : m = %d and n = %d”, m, n);
test();
}
void test()
{
int a = 50, b = 80;
printf(“nvalues : a = %d and b = %d”, a, b);
}
Output:
values : m = 22 and n = 44
values : a = 50 and b = 80
BY REHAN IJAZ
2. Example program for global variable in C:
 The scope of global variables will be throughout the program. These variables can be
accessed from anywhere in the program.
 This variable is defined outside the main function. So that, this variable is visible to main
function and all other sub functions.
#include<stdio.h>
void test();int m = 22, n = 44;
int a = 50, b = 80;
int main()
{
printf(“All variables are accessed from main function”);
printf(“nvalues: m=%d:n=%d:a=%d:b=%d”, m,n,a,b);
test();
}
void test()
{
printf(“nnAll variables are accessed from”
” test function”);
printf(“nvalues: m=%d:n=%d:a=%d:b=%d”, m,n,a,b);
}
Output:
All variables are accessed from main function
values : m = 22 : n = 44 : a = 50 : b = 80
All variables are accessed from test function
values : m = 22 : n = 44 : a = 50 : b = 80
BY REHAN IJAZ
C’s Identifiers
Identifiers in C language:
 Each program elements in a C program are given a name called identifiers.
 Names given to identify Variables, functions and arrays are examples for identifiers. eg.
x is a name given to integer variable in above program.
Rules for constructing identifier name in C:
1. First character should be an alphabet or underscore.
2. Succeeding characters might be digits or letter.
3. Punctuation and special characters aren’t allowed except underscore.
4. Identifiers should not be keywords.
BY REHAN IJAZ
C’s Key words
 Keywords are pre-defined words in a C compiler.
 Each keyword is meant to perform a specific function in a C program.
 Since keywords are referred names for compiler, they can’t be used as variable name.
C language supports 32 keywords which are given below.
auto double int struct const float short unsigned
break else long switch continue for signed void
case enum register typedef default goto sizeof volatile
char extern return union do if static while
BY REHAN IJAZ

More Related Content

What's hot

Data Input and Output
Data Input and OutputData Input and Output
Data Input and Output
Sabik T S
 
C Token’s
C Token’sC Token’s
C Token’s
Tarun Sharma
 
Unit ii ppt
Unit ii pptUnit ii ppt
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
Abhishek Sinha
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
tanmaymodi4
 
C program compiler presentation
C program compiler presentationC program compiler presentation
C program compiler presentation
Rigvendra Kumar Vardhan
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in C
Sowmya Jyothi
 
C programming Workshop
C programming WorkshopC programming Workshop
C programming Workshop
neosphere
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
programming9
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
Sabik T S
 
Input output statement in C
Input output statement in CInput output statement in C
Input output statement in C
Muthuganesh S
 
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
Aditya Vaishampayan
 
Learn C# Programming - Operators
Learn C# Programming - OperatorsLearn C# Programming - Operators
Learn C# Programming - Operators
Eng Teong Cheah
 
Input And Output
 Input And Output Input And Output
Input And Output
Ghaffar Khan
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
sachindane
 
C Programming
C ProgrammingC Programming
C Programming
Adil Jafri
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
Rai University
 
pointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handlingpointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handling
Rai University
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
eShikshak
 
C programming(Part 1)
C programming(Part 1)C programming(Part 1)
C programming(Part 1)
SURBHI SAROHA
 

What's hot (20)

Data Input and Output
Data Input and OutputData Input and Output
Data Input and Output
 
C Token’s
C Token’sC Token’s
C Token’s
 
Unit ii ppt
Unit ii pptUnit ii ppt
Unit ii ppt
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
C program compiler presentation
C program compiler presentationC program compiler presentation
C program compiler presentation
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in C
 
C programming Workshop
C programming WorkshopC programming Workshop
C programming Workshop
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
Input output statement in C
Input output statement in CInput output statement in C
Input output statement in C
 
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
 
Learn C# Programming - Operators
Learn C# Programming - OperatorsLearn C# Programming - Operators
Learn C# Programming - Operators
 
Input And Output
 Input And Output Input And Output
Input And Output
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
 
C Programming
C ProgrammingC Programming
C Programming
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
pointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handlingpointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handling
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
C programming(Part 1)
C programming(Part 1)C programming(Part 1)
C programming(Part 1)
 

Viewers also liked

Campbell Investments Limited Introduces Two New Multi-Asset Funds
Campbell Investments Limited Introduces Two New Multi-Asset FundsCampbell Investments Limited Introduces Two New Multi-Asset Funds
Campbell Investments Limited Introduces Two New Multi-Asset Funds
kjprsubmission04
 
Poca 140318195851-phpapp02
Poca 140318195851-phpapp02Poca 140318195851-phpapp02
Poca 140318195851-phpapp02
Leslie Vanesa Sanchez Montano
 
Fuzzy motor
Fuzzy motorFuzzy motor
Fuzzy motor
Seyed Yahya Moradi
 
Presentation
PresentationPresentation
Presentation
Seyed Yahya Moradi
 
CALIBRATION OF VEHICLE EMISSIONS-SPEED RELATIONSHIPS FOR THE GREATER CAIRO ROADS
CALIBRATION OF VEHICLE EMISSIONS-SPEED RELATIONSHIPS FOR THE GREATER CAIRO ROADSCALIBRATION OF VEHICLE EMISSIONS-SPEED RELATIONSHIPS FOR THE GREATER CAIRO ROADS
CALIBRATION OF VEHICLE EMISSIONS-SPEED RELATIONSHIPS FOR THE GREATER CAIRO ROADS
IAEME Publication
 
PARAMETRIC INVESTIGATIONS ON THE FLOW CHARACTERISTICS OF A CLOSED LOOP PULSAT...
PARAMETRIC INVESTIGATIONS ON THE FLOW CHARACTERISTICS OF A CLOSED LOOP PULSAT...PARAMETRIC INVESTIGATIONS ON THE FLOW CHARACTERISTICS OF A CLOSED LOOP PULSAT...
PARAMETRIC INVESTIGATIONS ON THE FLOW CHARACTERISTICS OF A CLOSED LOOP PULSAT...
IAEME Publication
 
Curriculum Vitae (2016)
Curriculum Vitae (2016)Curriculum Vitae (2016)
Curriculum Vitae (2016)
Instituto Superior Técnico
 
Felicitaciones
FelicitacionesFelicitaciones
Felicitaciones
anabelro
 
Comunicado n° 3 2
Comunicado n° 3 2Comunicado n° 3 2
Comunicado n° 3 2sukyedu
 
Naomi 5e
Naomi 5eNaomi 5e
SeniorDesign_PosterTemplateV1.2-1
SeniorDesign_PosterTemplateV1.2-1SeniorDesign_PosterTemplateV1.2-1
SeniorDesign_PosterTemplateV1.2-1
Phillip Power
 
Shot list
Shot list Shot list
Shot list
michellepeters1997
 
Crónicas de la ínsula 31 10
Crónicas de la ínsula 31 10Crónicas de la ínsula 31 10
Crónicas de la ínsula 31 10
megaradioexpress
 
Project Update - Earth Towne
Project Update - Earth TowneProject Update - Earth Towne
Project Update - Earth Towne
Earth Infrastructures Ltd.
 
CompTIA A+ ce certificate (1)
CompTIA A+ ce certificate (1)CompTIA A+ ce certificate (1)
CompTIA A+ ce certificate (1)
Colin Woodard
 
Cmp2412 programming principles
Cmp2412 programming principlesCmp2412 programming principles
Cmp2412 programming principles
NIKANOR THOMAS
 
ACSN Issue #9
ACSN Issue #9ACSN Issue #9
ACSN Issue #9
Tony Weiss
 
Presentation1
Presentation1Presentation1
Presentation1
rashmi kaushik
 
Reumatismo tratamiento
Reumatismo tratamientoReumatismo tratamiento
Reumatismo tratamiento
NEGOCIOS DESDE COLOMBIA
 
Pós-Graduação Gestão de Negócios Online
Pós-Graduação Gestão de Negócios OnlinePós-Graduação Gestão de Negócios Online
Pós-Graduação Gestão de Negócios Online
fredericocarvalho.pt
 

Viewers also liked (20)

Campbell Investments Limited Introduces Two New Multi-Asset Funds
Campbell Investments Limited Introduces Two New Multi-Asset FundsCampbell Investments Limited Introduces Two New Multi-Asset Funds
Campbell Investments Limited Introduces Two New Multi-Asset Funds
 
Poca 140318195851-phpapp02
Poca 140318195851-phpapp02Poca 140318195851-phpapp02
Poca 140318195851-phpapp02
 
Fuzzy motor
Fuzzy motorFuzzy motor
Fuzzy motor
 
Presentation
PresentationPresentation
Presentation
 
CALIBRATION OF VEHICLE EMISSIONS-SPEED RELATIONSHIPS FOR THE GREATER CAIRO ROADS
CALIBRATION OF VEHICLE EMISSIONS-SPEED RELATIONSHIPS FOR THE GREATER CAIRO ROADSCALIBRATION OF VEHICLE EMISSIONS-SPEED RELATIONSHIPS FOR THE GREATER CAIRO ROADS
CALIBRATION OF VEHICLE EMISSIONS-SPEED RELATIONSHIPS FOR THE GREATER CAIRO ROADS
 
PARAMETRIC INVESTIGATIONS ON THE FLOW CHARACTERISTICS OF A CLOSED LOOP PULSAT...
PARAMETRIC INVESTIGATIONS ON THE FLOW CHARACTERISTICS OF A CLOSED LOOP PULSAT...PARAMETRIC INVESTIGATIONS ON THE FLOW CHARACTERISTICS OF A CLOSED LOOP PULSAT...
PARAMETRIC INVESTIGATIONS ON THE FLOW CHARACTERISTICS OF A CLOSED LOOP PULSAT...
 
Curriculum Vitae (2016)
Curriculum Vitae (2016)Curriculum Vitae (2016)
Curriculum Vitae (2016)
 
Felicitaciones
FelicitacionesFelicitaciones
Felicitaciones
 
Comunicado n° 3 2
Comunicado n° 3 2Comunicado n° 3 2
Comunicado n° 3 2
 
Naomi 5e
Naomi 5eNaomi 5e
Naomi 5e
 
SeniorDesign_PosterTemplateV1.2-1
SeniorDesign_PosterTemplateV1.2-1SeniorDesign_PosterTemplateV1.2-1
SeniorDesign_PosterTemplateV1.2-1
 
Shot list
Shot list Shot list
Shot list
 
Crónicas de la ínsula 31 10
Crónicas de la ínsula 31 10Crónicas de la ínsula 31 10
Crónicas de la ínsula 31 10
 
Project Update - Earth Towne
Project Update - Earth TowneProject Update - Earth Towne
Project Update - Earth Towne
 
CompTIA A+ ce certificate (1)
CompTIA A+ ce certificate (1)CompTIA A+ ce certificate (1)
CompTIA A+ ce certificate (1)
 
Cmp2412 programming principles
Cmp2412 programming principlesCmp2412 programming principles
Cmp2412 programming principles
 
ACSN Issue #9
ACSN Issue #9ACSN Issue #9
ACSN Issue #9
 
Presentation1
Presentation1Presentation1
Presentation1
 
Reumatismo tratamiento
Reumatismo tratamientoReumatismo tratamiento
Reumatismo tratamiento
 
Pós-Graduação Gestão de Negócios Online
Pós-Graduação Gestão de Negócios OnlinePós-Graduação Gestão de Negócios Online
Pós-Graduação Gestão de Negócios Online
 

Similar to Programming Fundamentals lecture 4

comp 122 Chapter 2.pptx,language semantics
comp 122 Chapter 2.pptx,language semanticscomp 122 Chapter 2.pptx,language semantics
comp 122 Chapter 2.pptx,language semantics
floraaluoch3
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
JAYA
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
MOHAMAD NOH AHMAD
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
Mahira Banu
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
20EUEE018DEEPAKM
 
C
CC
C programming language for beginners
C programming language for beginners C programming language for beginners
C programming language for beginners
ShreyaSingh291866
 
Unit 2- Module 2.pptx
Unit 2- Module 2.pptxUnit 2- Module 2.pptx
Unit 2- Module 2.pptx
simranjotsingh2908
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
Likhil181
 
UNIT-1 notes(Data Types – Variables – Operations – Expressions and Statements...
UNIT-1 notes(Data Types – Variables – Operations – Expressions and Statements...UNIT-1 notes(Data Types – Variables – Operations – Expressions and Statements...
UNIT-1 notes(Data Types – Variables – Operations – Expressions and Statements...
RSathyaPriyaCSEKIOT
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
valarpink
 
java or oops class not in kerala polytechnic 4rth semester nots j
java or oops class not in kerala polytechnic  4rth semester nots jjava or oops class not in kerala polytechnic  4rth semester nots j
java or oops class not in kerala polytechnic 4rth semester nots j
ishorishore
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
C presentation book
C presentation bookC presentation book
C presentation book
krunal1210
 
Reduce course notes class xii
Reduce course notes class xiiReduce course notes class xii
Reduce course notes class xii
Syed Zaid Irshad
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
indrasir
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
madhurij54
 
2. introduction of a c program
2. introduction of a c program2. introduction of a c program
2. introduction of a c program
Alamgir Hossain
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
KrishanPalSingh39
 
C programming
C programmingC programming
C programming
PralhadKhanal1
 

Similar to Programming Fundamentals lecture 4 (20)

comp 122 Chapter 2.pptx,language semantics
comp 122 Chapter 2.pptx,language semanticscomp 122 Chapter 2.pptx,language semantics
comp 122 Chapter 2.pptx,language semantics
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
 
Introduction%20C.pptx
Introduction%20C.pptxIntroduction%20C.pptx
Introduction%20C.pptx
 
C
CC
C
 
C programming language for beginners
C programming language for beginners C programming language for beginners
C programming language for beginners
 
Unit 2- Module 2.pptx
Unit 2- Module 2.pptxUnit 2- Module 2.pptx
Unit 2- Module 2.pptx
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
UNIT-1 notes(Data Types – Variables – Operations – Expressions and Statements...
UNIT-1 notes(Data Types – Variables – Operations – Expressions and Statements...UNIT-1 notes(Data Types – Variables – Operations – Expressions and Statements...
UNIT-1 notes(Data Types – Variables – Operations – Expressions and Statements...
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
java or oops class not in kerala polytechnic 4rth semester nots j
java or oops class not in kerala polytechnic  4rth semester nots jjava or oops class not in kerala polytechnic  4rth semester nots j
java or oops class not in kerala polytechnic 4rth semester nots j
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
C presentation book
C presentation bookC presentation book
C presentation book
 
Reduce course notes class xii
Reduce course notes class xiiReduce course notes class xii
Reduce course notes class xii
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
 
2. introduction of a c program
2. introduction of a c program2. introduction of a c program
2. introduction of a c program
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
 
C programming
C programmingC programming
C programming
 

More from REHAN IJAZ

How to make presentation effective assignment
How to make presentation effective assignmentHow to make presentation effective assignment
How to make presentation effective assignment
REHAN IJAZ
 
Project code for Project on Student information management system
Project code for Project on Student information management systemProject code for Project on Student information management system
Project code for Project on Student information management system
REHAN IJAZ
 
Programming Fundamentals lecture 8
Programming Fundamentals lecture 8Programming Fundamentals lecture 8
Programming Fundamentals lecture 8
REHAN IJAZ
 
Introduction to artificial intelligence lecture 1
Introduction to artificial intelligence lecture 1Introduction to artificial intelligence lecture 1
Introduction to artificial intelligence lecture 1
REHAN IJAZ
 
Programming Fundamentals lecture 7
Programming Fundamentals lecture 7Programming Fundamentals lecture 7
Programming Fundamentals lecture 7
REHAN IJAZ
 
Programming Fundamentals lecture 6
Programming Fundamentals lecture 6Programming Fundamentals lecture 6
Programming Fundamentals lecture 6
REHAN IJAZ
 
Programming Fundamentals lecture 5
Programming Fundamentals lecture 5Programming Fundamentals lecture 5
Programming Fundamentals lecture 5
REHAN IJAZ
 
Programming Fundamentals lecture 3
Programming Fundamentals lecture 3Programming Fundamentals lecture 3
Programming Fundamentals lecture 3
REHAN IJAZ
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
REHAN IJAZ
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
REHAN IJAZ
 
Career development interviews
Career development interviewsCareer development interviews
Career development interviews
REHAN IJAZ
 
importance of Communication in business
importance of Communication in businessimportance of Communication in business
importance of Communication in business
REHAN IJAZ
 
Porposal on Student information management system
Porposal on Student information management systemPorposal on Student information management system
Porposal on Student information management system
REHAN IJAZ
 
Project on Student information management system
Project on Student information management systemProject on Student information management system
Project on Student information management system
REHAN IJAZ
 

More from REHAN IJAZ (14)

How to make presentation effective assignment
How to make presentation effective assignmentHow to make presentation effective assignment
How to make presentation effective assignment
 
Project code for Project on Student information management system
Project code for Project on Student information management systemProject code for Project on Student information management system
Project code for Project on Student information management system
 
Programming Fundamentals lecture 8
Programming Fundamentals lecture 8Programming Fundamentals lecture 8
Programming Fundamentals lecture 8
 
Introduction to artificial intelligence lecture 1
Introduction to artificial intelligence lecture 1Introduction to artificial intelligence lecture 1
Introduction to artificial intelligence lecture 1
 
Programming Fundamentals lecture 7
Programming Fundamentals lecture 7Programming Fundamentals lecture 7
Programming Fundamentals lecture 7
 
Programming Fundamentals lecture 6
Programming Fundamentals lecture 6Programming Fundamentals lecture 6
Programming Fundamentals lecture 6
 
Programming Fundamentals lecture 5
Programming Fundamentals lecture 5Programming Fundamentals lecture 5
Programming Fundamentals lecture 5
 
Programming Fundamentals lecture 3
Programming Fundamentals lecture 3Programming Fundamentals lecture 3
Programming Fundamentals lecture 3
 
Programming Fundamentals lecture 2
Programming Fundamentals lecture 2Programming Fundamentals lecture 2
Programming Fundamentals lecture 2
 
Programming Fundamentals lecture 1
Programming Fundamentals lecture 1Programming Fundamentals lecture 1
Programming Fundamentals lecture 1
 
Career development interviews
Career development interviewsCareer development interviews
Career development interviews
 
importance of Communication in business
importance of Communication in businessimportance of Communication in business
importance of Communication in business
 
Porposal on Student information management system
Porposal on Student information management systemPorposal on Student information management system
Porposal on Student information management system
 
Project on Student information management system
Project on Student information management systemProject on Student information management system
Project on Student information management system
 

Recently uploaded

原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
ydzowc
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
ijaia
 
P5 Working Drawings.pdf floor plan, civil
P5 Working Drawings.pdf floor plan, civilP5 Working Drawings.pdf floor plan, civil
P5 Working Drawings.pdf floor plan, civil
AnasAhmadNoor
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
uqyfuc
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...
Prakhyath Rai
 
Blood finder application project report (1).pdf
Blood finder application project report (1).pdfBlood finder application project report (1).pdf
Blood finder application project report (1).pdf
Kamal Acharya
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
nedcocy
 
smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...
um7474492
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
SENTIMENT ANALYSIS ON PPT AND Project template_.pptx
SENTIMENT ANALYSIS ON PPT AND Project template_.pptxSENTIMENT ANALYSIS ON PPT AND Project template_.pptx
SENTIMENT ANALYSIS ON PPT AND Project template_.pptx
b0754201
 
TIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptxTIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptx
CVCSOfficial
 
Open Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surfaceOpen Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surface
Indrajeet sahu
 
Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
PreethaV16
 
Height and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdfHeight and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdf
q30122000
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
upoux
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
sydezfe
 
AI-Based Home Security System : Home security
AI-Based Home Security System : Home securityAI-Based Home Security System : Home security
AI-Based Home Security System : Home security
AIRCC Publishing Corporation
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
Prakhyath Rai
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
Dwarkadas J Sanghvi College of Engineering
 

Recently uploaded (20)

原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
P5 Working Drawings.pdf floor plan, civil
P5 Working Drawings.pdf floor plan, civilP5 Working Drawings.pdf floor plan, civil
P5 Working Drawings.pdf floor plan, civil
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...
 
Blood finder application project report (1).pdf
Blood finder application project report (1).pdfBlood finder application project report (1).pdf
Blood finder application project report (1).pdf
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
 
smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
SENTIMENT ANALYSIS ON PPT AND Project template_.pptx
SENTIMENT ANALYSIS ON PPT AND Project template_.pptxSENTIMENT ANALYSIS ON PPT AND Project template_.pptx
SENTIMENT ANALYSIS ON PPT AND Project template_.pptx
 
TIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptxTIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptx
 
Open Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surfaceOpen Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surface
 
Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
 
Height and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdfHeight and depth gauge linear metrology.pdf
Height and depth gauge linear metrology.pdf
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
 
AI-Based Home Security System : Home security
AI-Based Home Security System : Home securityAI-Based Home Security System : Home security
AI-Based Home Security System : Home security
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
 

Programming Fundamentals lecture 4

  • 1. BY REHAN IJAZ 04- Getting Started with C
  • 2. BY REHAN IJAZ C's Character Set C does not use, nor requires the use of, every character found on a modern computer keyboard. The use of most of this set of characters will be discussed throughout the course. The only characters required by the C Programming Language are as follows: character:- It denotes any alphabet, digit or special symbol used to represent information. Use:- These characters can be combined to form variables. C uses variables, operators, keywords and expressions as building blocks to form a basic C program. Character set:- The character set is the fundamental raw material of any language and they are used to represent information. Like natural languages, computer language will also have well defined character set, which is useful to build the programs. The characters in C are grouped into the following two categories: 1. Source characterset a. Alphabets b. Digits c. Special Characters d. White Spaces 2. Execution characterset a. Escape Sequence 1. Source character set ALPHABETS Uppercase letters A-Z Lowercase letters a-z DIGITS 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 SPECIAL CHARACTERS WHITESPACE CHARACTERS b blank space t horizontal tab v vertical tab r carriage return f form feed n new line
  • 3. BY REHAN IJAZ Back slash ’ Single quote " Double quote ? Question mark 0 Null a Alarm (bell) 2. Execution Character Set Certain ASCII characters are unprintable, which means they are not displayed on the screen or printer. Those characters perform other functions aside from displaying text. Examples are backspacing or moving to a newline . They are used in output statements. Escape sequence usually consists of a backslash and a letter or a combination of digits. An escape sequence is considered as a single character but a valid character constant. These are employed at the time of execution of the program. Execution characters set are always represented by a backslash () followed by a character. Note that each one of character constants represents one character, although they consist of two characters. These characters combinations are called as escape sequence. Escape Sequence Invalid Sequence #include <stdio.h> int main() { printf("Hello, world!"); } Correct Sequence #include <stdio.h> int main() { printf("Hello,nworld!"); }
  • 4. BY REHAN IJAZ More Escape Sequences  Null 0 Null  Alarm (bell) a Beep Sound  Back space b Moves previous position  Horizontal tab t Moves next horizontal tab  New line n Moves next Line  Vertical tab v Moves next vertical tab  Form feed f Moves initial position of next page  Carriage return r Moves beginning of the line  Double quote " Present Double quotes  Single quote ' Present Apostrophe  Question mark ? Present Question Mark  Back slash Present back slash
  • 5. BY REHAN IJAZ C’s Variable  C variable is a named location in a memory where a program can manipulate the data. This location is used to hold the value of the variable.  The value of the C variable may get change in the program.  C variable might be belonging to any of the data type like int, float, char etc. Rules for naming C variable: 1. Variable name must begin with letter or underscore. 2. Variable names are case sensitive 3. They can be constructed with digits, letters. 4. No special symbols are allowed other than underscore. 5. sum, height, _value are some examples for variable name Declaring & initializing C variable:  Variables should be declared in the C program before to use.  Memory space is not allocated for a variable while declaration. It happens only on variable definition.  Variable initialization means assigning a value to the variable. S.No Type Syntax Example 1 Variable declaration data_type variable_name; int x, y, z; char flat, ch; 2 Variable initialization data_type variable_name = value; int x = 50, y = 30; char flag = ‘x’, ch=’l’; Variable types There are three types of variables in C program They are, 1. Local variable 2. Global variable 3. Environment variable
  • 6. BY REHAN IJAZ 1. Example program for local variable in C:  The scope of local variables will be within the function only.  These variables are declared within the function and can’t be accessed outside the function.  In the below example, m and n variables are having scope within the main function only. These are not visible to test function.  Like wise, a and b variables are having scope within the test function only. These are not visible to main function. #include<stdio.h> void test(); int main() { int m = 22, n = 44; printf(“nvalues : m = %d and n = %d”, m, n); test(); } void test() { int a = 50, b = 80; printf(“nvalues : a = %d and b = %d”, a, b); } Output: values : m = 22 and n = 44 values : a = 50 and b = 80
  • 7. BY REHAN IJAZ 2. Example program for global variable in C:  The scope of global variables will be throughout the program. These variables can be accessed from anywhere in the program.  This variable is defined outside the main function. So that, this variable is visible to main function and all other sub functions. #include<stdio.h> void test();int m = 22, n = 44; int a = 50, b = 80; int main() { printf(“All variables are accessed from main function”); printf(“nvalues: m=%d:n=%d:a=%d:b=%d”, m,n,a,b); test(); } void test() { printf(“nnAll variables are accessed from” ” test function”); printf(“nvalues: m=%d:n=%d:a=%d:b=%d”, m,n,a,b); } Output: All variables are accessed from main function values : m = 22 : n = 44 : a = 50 : b = 80 All variables are accessed from test function values : m = 22 : n = 44 : a = 50 : b = 80
  • 8. BY REHAN IJAZ C’s Identifiers Identifiers in C language:  Each program elements in a C program are given a name called identifiers.  Names given to identify Variables, functions and arrays are examples for identifiers. eg. x is a name given to integer variable in above program. Rules for constructing identifier name in C: 1. First character should be an alphabet or underscore. 2. Succeeding characters might be digits or letter. 3. Punctuation and special characters aren’t allowed except underscore. 4. Identifiers should not be keywords.
  • 9. BY REHAN IJAZ C’s Key words  Keywords are pre-defined words in a C compiler.  Each keyword is meant to perform a specific function in a C program.  Since keywords are referred names for compiler, they can’t be used as variable name. C language supports 32 keywords which are given below. auto double int struct const float short unsigned break else long switch continue for signed void case enum register typedef default goto sizeof volatile char extern return union do if static while