CPL Lecture-01
CPL Lecture-01
Language
Instructor: Jarin Tasnim
Email: [email protected]
Number: 01844505100
Introduction to C
▪ C is a structured programming language
▪ C supports functions that enables easy maintainability of code, by breaking large file
into smaller modules
▪ Comments in C provides easy readability
▪ C is a powerful language
Program Structure
A sample C program
#include<stdio.h>
Int main()
{
other statements
//comments after double slash
}
Header Files
• The files that are specified in the include section is called as header file
• These are precompiled files that has some functions defined in them
• We can call those functions in our program by supplying parameters
• Header file is given an extension .h
• C source file is given an extension .c
Main Function
• Should not be a reversed word like int, float, do, while etc..
• Should start with a letter or an underscore(_)
• Can contain letters, numbers or underscore.
• No other special characters are allowed including space
• Variable names are case sensitive
• A and a are different.
Input and Output
• Input
• Scanf(“%d”, &a);
• Gets an integer value from the user and stores it under the name “a”
• Output
• Printf(“%d”, a);
• Prints the value present in variable a on the screen