Unit - 1 CP (Lecture 4)
Unit - 1 CP (Lecture 4)
1
Topics to be Covered
• Structure of C Program
• Comments
• Header files
• Preprocessor directives.
1. Documentation section
2. Link Section
3. Definition Section
4. Global declaration section
5. Function prototype declaration section
6. Main function
7. User defined function definition section
3
Structure of C Program Example
4
Rules to write C Program
1. All C statements must end with semicolon.
2. C is case-sensitive. That is, upper case and lower case characters are different.
Generally the statements are typed in lowercase.
3. Braces must always match upon pairs, i.e., every opening brace { must have a
matching closing brace }.
4. Every C program starts with void main() function.
5. Comments cannot be nested. For example,
/*Welcome to ‘C’,/*programming*/*/
A comment can be split into more than one line.
5
Basic Concepts
• Preprocessor directives
• Header files
• Character set
• Keywords
• Identifiers
• Variables
• Constants
• Operators
• Data types and their storage
6
Preprocessor Directive
• Before a C program is compiled in a compiler, source code is processed by a program
called pre-processor.
• Commands used in pre-processor are called pre-processor directives and they begin
with “#” symbol.
7
Preprocessor Directive
• Request the use of a header file in program by including it, with the C pre-
processing directive #include which comes along with your compiler.
9
Header Files
[2] https://www.wikitechy.com/tutorials/c-programming/preprocessor-directives
[3] https://codingsec.net/2016/09/every-library-file-function-c-programming/
11
Reference Books
• T1 E. Balaguruswamy, Programming in ANSI, McGraw-Hill Education,
• https://bookmart.online/shop/programming-in-ansi-c-8-e-balagurusamy-second-hand-book/?ut
m_source=Google%20Shopping&utm_campaign=test&utm_medium=cpc&utm_term=498
12
THANK YOU
For queries
Email:[email protected]