SlideShare una empresa de Scribd logo
1 de 7
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.

Más contenido relacionado

La actualidad más candente

lipid & it's metabolism (1).pptx
lipid & it's metabolism (1).pptxlipid & it's metabolism (1).pptx
lipid & it's metabolism (1).pptxeyobkaseye
 
prescription lecture.pptx
prescription lecture.pptxprescription lecture.pptx
prescription lecture.pptxsaba999666
 
Fatty acids (Chemistry of Lipids (Part - II)
Fatty acids (Chemistry of Lipids (Part - II)Fatty acids (Chemistry of Lipids (Part - II)
Fatty acids (Chemistry of Lipids (Part - II)Ashok Katta
 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++ Samsil Arefin
 
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothiArrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothiSowmya Jyothi
 
COM1407: Variables and Data Types
COM1407: Variables and Data Types COM1407: Variables and Data Types
COM1407: Variables and Data Types Hemantha Kulathilake
 
Unit II chapter 4 Loops in C
Unit II chapter 4 Loops in CUnit II chapter 4 Loops in C
Unit II chapter 4 Loops in CSowmya Jyothi
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdfMANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdfSTRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
Miscllaneous inorganic Pharmaceutical agents
Miscllaneous inorganic Pharmaceutical agentsMiscllaneous inorganic Pharmaceutical agents
Miscllaneous inorganic Pharmaceutical agentsTaj Khan
 
Chemistry of lipids MUHAMMAD MUSTANSAR
Chemistry of lipids  MUHAMMAD MUSTANSARChemistry of lipids  MUHAMMAD MUSTANSAR
Chemistry of lipids MUHAMMAD MUSTANSARDr Muhammad Mustansar
 
Structure of C program
Structure of C programStructure of C program
Structure of C programPavan prasad
 
monophasic liquid dosage forms
monophasic liquid dosage formsmonophasic liquid dosage forms
monophasic liquid dosage formsBikashAdhikari26
 

La actualidad más candente (20)

Preprocessor
PreprocessorPreprocessor
Preprocessor
 
lipid & it's metabolism (1).pptx
lipid & it's metabolism (1).pptxlipid & it's metabolism (1).pptx
lipid & it's metabolism (1).pptx
 
prescription lecture.pptx
prescription lecture.pptxprescription lecture.pptx
prescription lecture.pptx
 
Fatty acids (Chemistry of Lipids (Part - II)
Fatty acids (Chemistry of Lipids (Part - II)Fatty acids (Chemistry of Lipids (Part - II)
Fatty acids (Chemistry of Lipids (Part - II)
 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++
 
History of c++
History of c++History of c++
History of c++
 
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothiArrays in c unit iii chapter 1 mrs.sowmya jyothi
Arrays in c unit iii chapter 1 mrs.sowmya jyothi
 
C basics
C   basicsC   basics
C basics
 
COM1407: Variables and Data Types
COM1407: Variables and Data Types COM1407: Variables and Data Types
COM1407: Variables and Data Types
 
Unit II chapter 4 Loops in C
Unit II chapter 4 Loops in CUnit II chapter 4 Loops in C
Unit II chapter 4 Loops in C
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdfMANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
 
HEMOGLOBIN
HEMOGLOBINHEMOGLOBIN
HEMOGLOBIN
 
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdfSTRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
 
AMINO ACIDS.pdf
AMINO ACIDS.pdfAMINO ACIDS.pdf
AMINO ACIDS.pdf
 
Miscllaneous inorganic Pharmaceutical agents
Miscllaneous inorganic Pharmaceutical agentsMiscllaneous inorganic Pharmaceutical agents
Miscllaneous inorganic Pharmaceutical agents
 
C++ Arrays
C++ ArraysC++ Arrays
C++ Arrays
 
Chemistry of lipids MUHAMMAD MUSTANSAR
Chemistry of lipids  MUHAMMAD MUSTANSARChemistry of lipids  MUHAMMAD MUSTANSAR
Chemistry of lipids MUHAMMAD MUSTANSAR
 
Structure of C program
Structure of C programStructure of C program
Structure of C program
 
Lipolysis
Lipolysis Lipolysis
Lipolysis
 
monophasic liquid dosage forms
monophasic liquid dosage formsmonophasic liquid dosage forms
monophasic liquid dosage forms
 

Similar a C Programming Language Features and Structure

Chapter 3(1)
Chapter 3(1)Chapter 3(1)
Chapter 3(1)TejaswiB4
 
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).pptxSanketShah544615
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptxMugilvannan11
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c languagefarishah
 
C programming course material
C programming course materialC programming course material
C programming course materialRanjitha Murthy
 
Chapter3
Chapter3Chapter3
Chapter3Kamran
 
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.pdfKirubelWondwoson1
 
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).pptxrajkumar490591
 
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 CANTTBatra Centre
 
2.Overview of C language.pptx
2.Overview of C language.pptx2.Overview of C language.pptx
2.Overview of C language.pptxVishwas459764
 
C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeksAashutoshChhedavi
 

Similar a C Programming Language Features and Structure (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
 

Último

Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleCeline George
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 

Último (20)

Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP Module
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 

C Programming Language Features and Structure

  • 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.