SlideShare a Scribd company logo
1
C Programming Language
Group A
1. What is Programming Language? What down some salient
features of C Programming Language?
Ans: Computer Programming is simply writing down instructions for the computer
to follow. For stating the instructions, we need some language in which to state the
instructions. Unfortunately nature language such as English is insufficiently precise
for giving instructions to computers. Instead, we use special purpose languages
called programming Language. Thus programming Dan be defined as process of
writing, testing, debugging/troubleshooting and maintaining the source code of
computer programs.
Salient Features of C Programming
 C is a general purpose language i.e. it can be used for any type of
programming solution.
 It is a structured programming, so it provides a disciplined approach to write
the program.
 It has high level constructs, which gives users the programming efficiency.
 It can handle low level language, which gives the machine efficiency.
 It has a rich set of built-in functions and operators that can be used to write
any complex program.
 Program written in C are efficient and fast due to its variety of data types and
powerful operators.
2. What is C token? Explain the basic structure of a C program?
Ans: Individual word and punctuation marks are called C tokens. In a C program
the smallest individual units are known as C tokens. C has six types of tokens as
shown in Fig 2.
C Token
Keyword Identifier Constant String Special Symbol Operator
Fig 1: C Token.
2
Basic Structure of C Program
The basic structure of C is given in Fig 2.
Documentation section
Link section
Definition
Section
Global declaration section
main() function section
{
Declaration part
Executable
}
Sub program section
function 1
function 2
…………….
Fig 2: basic Structure of C program
 DocumentationSection
 It is set of Computer Line
 It includes Title Of Program, Author Name
 Data Used Or Summary Information
 Link Section
 It is also called Header File Declaration Section
 It Links Compiler to Link Functions From System Library
 Definition Section
 Defines Symbolic Constants
 Eg. #define Count 10
 Global DeclarationSection
 Variable that are accessed byone or more functions are called Global
Variable
 Global Variables are declared in this Section.
 Global Variables are always Declared outside of all Functions
 May Contain Function Definition
 Main Function Section
 User to start of actual C program.
 It include two parts as declaration part and executable part.
 Sub ProgramSection
 It has all User-defined Functions that are called in main
 User Defined Functions are generally placed immediately after main
3
3. Write down the steps of executing a C program. What are the
different forms of main statements C permits?
Ans: C program executes in 4 (four steps). This is given in Fig 3.
Create
program
Compile
program
Link
program
Execute
program
Fig 3: Executing of a C Program
 Creating a program
An editor like notepad or WordPad is used to create a C program. This file contains a
sourcecodewhich consists of executable code. The file should be saved as ‘*.c’
extension only.
 Compiling the program
The next step is to compile the program. The codeis compiled by using compiler.
Compiler converts executable codeto binary codei.e. object code.
 Linking a program to library
The object codeof a program is linked with libraries that are needed for execution of a
program. The linker is used to link the program with libraries. It creates a file with
‘*.exe’extension.
 Executing the program
The final executable file is then run by dos command prompt or by any other software.
Different Forms of main() Statement
C permits different forms of main statement. The following forms are allowed:
 main()
 main(void)
 int main()
 void main()
 void main(void)
 int main(void)
 main() and main(void)
The empty pair of parentheses main()and also the main(void) indicates that the
function has no argument.
 int main()
The statement intmain()indicates that the function returns an integer value to the
operating system.
 void main()
The statement void main() indicates that the function does not return any information
to the operating system.
 void main(void)
The statement void main(void) indicates that the function does not return any
information to the operating system and it has no argument.
4
 int main (void)
The statement intmain(void) indicates that the function returns an integer value to the
operating system and it has no argument.
4. Describe the purpose of #define and #include directive. Why
should not these directive end with a semicolon?
Ans: The #define Directive
A #define is a preprocessorcompiler directive and not a statement. Therefore
#define line should not end with a semicolon. Symbolic constants are generally
written in uppercaseso that they are easily distinguished from lowercase variable
names. #define instructions are usually placed at the beginning before the main()
function. Symbolic constants are not declared in declaration section.
The #include Directive
As mentioned earlier, C programs are divided into modules or functions. Some
functions are written by users, like us and many others are srored in the C library.
Library Functions are grouped category-wise and stored in different files known as
header files. If we want to access the functions stored in the library. It is necessary
to tell the compiler about the files to be accessed.
This is achieved by using the preprocessordirective #include as follows:
#include<filename>
filenameis the name of the library file that contains the required function
definition. Preprocessordirective are placed at the beginning of a program.
5. Draw a flow chart that shows the process of compiling and
running a C program.
Ans: The process of compiling and running a C program is given in Fig 4.
5
System ready
Program code Enter program
Source code
Edit source program
C compiler Compile source program
Yes
No Object code
System
library
Link with the system library
Executable object code
Input data Execute object code
Data errors Logic errors
No errors
Correct output
Srop
Fig 4: Process of Compiling And Running A C Program.
6. What is a tri-graph character? How are they useful?
Ans: Many non-English keywords do not support some special character. To
overcome this program, Table 1. ANCI C introduces the conceptof “tri-graph”
sequences to provide a way to enter certain characters that are not available in some
keyboards, each characters are known as “tri-graph” character. Table 2 shows the
trigraph character.
Syntax errors?
Logic & data
error
6
Letters Digits
Uppercase A….Z All decimal digits 0….9
Lowercase a….z
Special Characters
, comma & ampersand
. period ^ caret
; semicolon * asterisk
: colon - minus
? question mark + plus sign
‘ apostrophe < opening angle bracket(or less than
sign)
“ quotation mark > closing angle bracket(or greater than
sign)
!exclamation mark ( left parenthesis
/ slash ) right parenthesis
 backslash [ left bracket
~ tilde ] right bracket
_ under score { left brace
$ dollar sign } right brace
White Spaces
Blank space
Horizontal tab
Carriage return
New line
Table 1: C Character Set
Table 2: ANSI C Tri-graph Sequences
Tri-graph sequence Translation
??= # number
??( [ left bracket
??) ] right bracket
??< { left brace
??> } right brace
??! | vertical bar
??/  back slash
?? ^ caret
??- ~ tilde
6. What are the rules for declaring identifiers?
Ans: An identifier is a name. It can be the name of a variable, function, a structure
or union, a member of a struct, union or enum, a typedef name, a macro name or a
macro variable.
Example:
Sum, toal_marks,sub1, sub2.
7
Rules for Declaring an Identifier
 Identifier name must be a sequence of letter and digits and must begin with a
letter.
 The underscorecharacter (‘_’) is considered as letter.
 Names shouldn’t be a keyword (such as int, float, if, break, for etc).
 Both upper-case letter and lower-case letter characters are allowed.
However, they’re not interchangeable.
 No identifier may be keyword.
 No special characters, such as semicolon, period, blank space, slash or
comma are permitted.

More Related Content

What's hot

C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class library
Prem Kumar Badri
 
Lex
LexLex
Compiler Design Unit 1
Compiler Design Unit 1Compiler Design Unit 1
Compiler Design Unit 1
Jena Catherine Bel D
 
Programming in c
Programming in cProgramming in c
Programming in c
ankitjain851
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Sandeep Kumar Singh
 
Flowcharts and algorithms
Flowcharts and algorithmsFlowcharts and algorithms
Flowcharts and algorithms
Student
 
Event Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdfEvent Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdf
AliEndris3
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction
Thapar Institute
 
Internal working JVM
Internal working JVMInternal working JVM
Internal working JVM
ShubhamGupta345141
 
Modular programming
Modular programmingModular programming
Modular programming
BeebashPokhrel
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
Prof. Dr. K. Adisesha
 
Language processor
Language processorLanguage processor
Language processor
Muhammad Mudarrak
 
1 - Introduction to Compilers.ppt
1 - Introduction to Compilers.ppt1 - Introduction to Compilers.ppt
1 - Introduction to Compilers.ppt
Rakesh Kumar
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
MOHIT AGARWAL
 
RECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSINGRECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSING
Jothi Lakshmi
 
Compiler Chapter 1
Compiler Chapter 1Compiler Chapter 1
Compiler Chapter 1
Huawei Technologies
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptx
classall
 
Java-java virtual machine
Java-java virtual machineJava-java virtual machine
Java-java virtual machine
Surbhi Panhalkar
 
Compiler design
Compiler designCompiler design
Compiler design
Thakur Ganeshsingh Thakur
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
TejaswiB4
 

What's hot (20)

C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class library
 
Lex
LexLex
Lex
 
Compiler Design Unit 1
Compiler Design Unit 1Compiler Design Unit 1
Compiler Design Unit 1
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Flowcharts and algorithms
Flowcharts and algorithmsFlowcharts and algorithms
Flowcharts and algorithms
 
Event Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdfEvent Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdf
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction
 
Internal working JVM
Internal working JVMInternal working JVM
Internal working JVM
 
Modular programming
Modular programmingModular programming
Modular programming
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
 
Language processor
Language processorLanguage processor
Language processor
 
1 - Introduction to Compilers.ppt
1 - Introduction to Compilers.ppt1 - Introduction to Compilers.ppt
1 - Introduction to Compilers.ppt
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
 
RECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSINGRECURSIVE DESCENT PARSING
RECURSIVE DESCENT PARSING
 
Compiler Chapter 1
Compiler Chapter 1Compiler Chapter 1
Compiler Chapter 1
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptx
 
Java-java virtual machine
Java-java virtual machineJava-java virtual machine
Java-java virtual machine
 
Compiler design
Compiler designCompiler design
Compiler design
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
 

Similar to C programming languag for cse students

Chapter 3(1)
Chapter 3(1)Chapter 3(1)
Chapter 3(1)
TejaswiB4
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
Vikram Nandini
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptx
SanketShah544615
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
Mugilvannan11
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
farishah
 
UNIT 1 NOTES.docx
UNIT 1 NOTES.docxUNIT 1 NOTES.docx
UNIT 1 NOTES.docx
Revathiparamanathan
 
Unit 1.1 - Introduction to C.pptx
Unit 1.1 - Introduction to C.pptxUnit 1.1 - Introduction to C.pptx
Unit 1.1 - Introduction to C.pptx
NandhaGopal Subramani
 
C programming course material
C programming course materialC programming course material
C programming course material
Ranjitha Murthy
 
Cp week _2.
Cp week _2.Cp week _2.
Cp week _2.
shahidullah57
 
C programming
C programmingC programming
C programming
Rounak Samdadia
 
C programming
C programmingC programming
Chapter3
Chapter3Chapter3
Chapter3
Kamran
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
C programming.pdf
C programming.pdfC programming.pdf
C programming.pdf
JitendraYadav351971
 
Chapter 1 - Basic concepts of programming.pdf
Chapter 1 - Basic concepts of programming.pdfChapter 1 - Basic concepts of programming.pdf
Chapter 1 - Basic concepts of programming.pdf
KirubelWondwoson1
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
indrasir
 
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptxIIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
rajkumar490591
 
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTTC programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
Batra Centre
 
2.Overview of C language.pptx
2.Overview of C language.pptx2.Overview of C language.pptx
2.Overview of C language.pptx
Vishwas459764
 
C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeks
AashutoshChhedavi
 

Similar to C programming languag for cse students (20)

Chapter 3(1)
Chapter 3(1)Chapter 3(1)
Chapter 3(1)
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
Unit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptxUnit-2_Getting Started With ‘C’ Language (3).pptx
Unit-2_Getting Started With ‘C’ Language (3).pptx
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
 
UNIT 1 NOTES.docx
UNIT 1 NOTES.docxUNIT 1 NOTES.docx
UNIT 1 NOTES.docx
 
Unit 1.1 - Introduction to C.pptx
Unit 1.1 - Introduction to C.pptxUnit 1.1 - Introduction to C.pptx
Unit 1.1 - Introduction to C.pptx
 
C programming course material
C programming course materialC programming course material
C programming course material
 
Cp week _2.
Cp week _2.Cp week _2.
Cp week _2.
 
C programming
C programmingC programming
C programming
 
C programming
C programmingC programming
C programming
 
Chapter3
Chapter3Chapter3
Chapter3
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
C programming.pdf
C programming.pdfC programming.pdf
C programming.pdf
 
Chapter 1 - Basic concepts of programming.pdf
Chapter 1 - Basic concepts of programming.pdfChapter 1 - Basic concepts of programming.pdf
Chapter 1 - Basic concepts of programming.pdf
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
 
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptxIIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptx
 
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTTC programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
 
2.Overview of C language.pptx
2.Overview of C language.pptx2.Overview of C language.pptx
2.Overview of C language.pptx
 
C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeks
 

Recently uploaded

Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 

Recently uploaded (20)

Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 

C programming languag for cse students

  • 1. 1 C Programming Language Group A 1. What is Programming Language? What down some salient features of C Programming Language? Ans: Computer Programming is simply writing down instructions for the computer to follow. For stating the instructions, we need some language in which to state the instructions. Unfortunately nature language such as English is insufficiently precise for giving instructions to computers. Instead, we use special purpose languages called programming Language. Thus programming Dan be defined as process of writing, testing, debugging/troubleshooting and maintaining the source code of computer programs. Salient Features of C Programming  C is a general purpose language i.e. it can be used for any type of programming solution.  It is a structured programming, so it provides a disciplined approach to write the program.  It has high level constructs, which gives users the programming efficiency.  It can handle low level language, which gives the machine efficiency.  It has a rich set of built-in functions and operators that can be used to write any complex program.  Program written in C are efficient and fast due to its variety of data types and powerful operators. 2. What is C token? Explain the basic structure of a C program? Ans: Individual word and punctuation marks are called C tokens. In a C program the smallest individual units are known as C tokens. C has six types of tokens as shown in Fig 2. C Token Keyword Identifier Constant String Special Symbol Operator Fig 1: C Token.
  • 2. 2 Basic Structure of C Program The basic structure of C is given in Fig 2. Documentation section Link section Definition Section Global declaration section main() function section { Declaration part Executable } Sub program section function 1 function 2 ……………. Fig 2: basic Structure of C program  DocumentationSection  It is set of Computer Line  It includes Title Of Program, Author Name  Data Used Or Summary Information  Link Section  It is also called Header File Declaration Section  It Links Compiler to Link Functions From System Library  Definition Section  Defines Symbolic Constants  Eg. #define Count 10  Global DeclarationSection  Variable that are accessed byone or more functions are called Global Variable  Global Variables are declared in this Section.  Global Variables are always Declared outside of all Functions  May Contain Function Definition  Main Function Section  User to start of actual C program.  It include two parts as declaration part and executable part.  Sub ProgramSection  It has all User-defined Functions that are called in main  User Defined Functions are generally placed immediately after main
  • 3. 3 3. Write down the steps of executing a C program. What are the different forms of main statements C permits? Ans: C program executes in 4 (four steps). This is given in Fig 3. Create program Compile program Link program Execute program Fig 3: Executing of a C Program  Creating a program An editor like notepad or WordPad is used to create a C program. This file contains a sourcecodewhich consists of executable code. The file should be saved as ‘*.c’ extension only.  Compiling the program The next step is to compile the program. The codeis compiled by using compiler. Compiler converts executable codeto binary codei.e. object code.  Linking a program to library The object codeof a program is linked with libraries that are needed for execution of a program. The linker is used to link the program with libraries. It creates a file with ‘*.exe’extension.  Executing the program The final executable file is then run by dos command prompt or by any other software. Different Forms of main() Statement C permits different forms of main statement. The following forms are allowed:  main()  main(void)  int main()  void main()  void main(void)  int main(void)  main() and main(void) The empty pair of parentheses main()and also the main(void) indicates that the function has no argument.  int main() The statement intmain()indicates that the function returns an integer value to the operating system.  void main() The statement void main() indicates that the function does not return any information to the operating system.  void main(void) The statement void main(void) indicates that the function does not return any information to the operating system and it has no argument.
  • 4. 4  int main (void) The statement intmain(void) indicates that the function returns an integer value to the operating system and it has no argument. 4. Describe the purpose of #define and #include directive. Why should not these directive end with a semicolon? Ans: The #define Directive A #define is a preprocessorcompiler directive and not a statement. Therefore #define line should not end with a semicolon. Symbolic constants are generally written in uppercaseso that they are easily distinguished from lowercase variable names. #define instructions are usually placed at the beginning before the main() function. Symbolic constants are not declared in declaration section. The #include Directive As mentioned earlier, C programs are divided into modules or functions. Some functions are written by users, like us and many others are srored in the C library. Library Functions are grouped category-wise and stored in different files known as header files. If we want to access the functions stored in the library. It is necessary to tell the compiler about the files to be accessed. This is achieved by using the preprocessordirective #include as follows: #include<filename> filenameis the name of the library file that contains the required function definition. Preprocessordirective are placed at the beginning of a program. 5. Draw a flow chart that shows the process of compiling and running a C program. Ans: The process of compiling and running a C program is given in Fig 4.
  • 5. 5 System ready Program code Enter program Source code Edit source program C compiler Compile source program Yes No Object code System library Link with the system library Executable object code Input data Execute object code Data errors Logic errors No errors Correct output Srop Fig 4: Process of Compiling And Running A C Program. 6. What is a tri-graph character? How are they useful? Ans: Many non-English keywords do not support some special character. To overcome this program, Table 1. ANCI C introduces the conceptof “tri-graph” sequences to provide a way to enter certain characters that are not available in some keyboards, each characters are known as “tri-graph” character. Table 2 shows the trigraph character. Syntax errors? Logic & data error
  • 6. 6 Letters Digits Uppercase A….Z All decimal digits 0….9 Lowercase a….z Special Characters , comma & ampersand . period ^ caret ; semicolon * asterisk : colon - minus ? question mark + plus sign ‘ apostrophe < opening angle bracket(or less than sign) “ quotation mark > closing angle bracket(or greater than sign) !exclamation mark ( left parenthesis / slash ) right parenthesis backslash [ left bracket ~ tilde ] right bracket _ under score { left brace $ dollar sign } right brace White Spaces Blank space Horizontal tab Carriage return New line Table 1: C Character Set Table 2: ANSI C Tri-graph Sequences Tri-graph sequence Translation ??= # number ??( [ left bracket ??) ] right bracket ??< { left brace ??> } right brace ??! | vertical bar ??/ back slash ?? ^ caret ??- ~ tilde 6. What are the rules for declaring identifiers? Ans: An identifier is a name. It can be the name of a variable, function, a structure or union, a member of a struct, union or enum, a typedef name, a macro name or a macro variable. Example: Sum, toal_marks,sub1, sub2.
  • 7. 7 Rules for Declaring an Identifier  Identifier name must be a sequence of letter and digits and must begin with a letter.  The underscorecharacter (‘_’) is considered as letter.  Names shouldn’t be a keyword (such as int, float, if, break, for etc).  Both upper-case letter and lower-case letter characters are allowed. However, they’re not interchangeable.  No identifier may be keyword.  No special characters, such as semicolon, period, blank space, slash or comma are permitted.