SlideShare a Scribd company logo
STUDY C LANGUAGE
WITH
ARAFAT BIN REZA
INTRODUCTION OF C LANGUAGE
• What is C Language?
• C is a general-purpose, procedural, imperative computer programming language.
• C is the most widely used computer language.
• If you are new to programming, C is a good choice to start your programming journey.
INTRODUCTION OF C LANGUAGE
• C has now become a widely used professional language for various reasons −
• Easy to learn
• Structured language
• It produces efficient programs
• It can handle low-level activities
• It can be compiled on a variety of computer platforms
INTRODUCTION OF C LANGUAGE
• Different parts of C program.
• Pre-processor
• Header file
• Function
• Variables
• expression
• Comment
MY FIRST PROGRAM IN C LANGUAGE .
• #include <stdio.h>
•
• int main()
• {
• /* my first program in C */
• printf("Hello, World! n");
•
• return 0;
• }
MY FIRST PROGRAM IN C LANGUAGE .
1. Pre-processor :
#include, the first word of any C program. It is also known as pre-processor. The main work of pre-
processor is to initialize the environment of program, i.e to link the program with the header file <stdio.h>.
2. Header file:
Header file is a collection of built-in functions that help us in our program. Header files contain definitions
of functions and variables which can be incorporated into any C program by pre-processor #include
statement. Standard header files are provided with each compiler, and cover a range of areas like string
handling, mathematical functions, data conversion, printing and reading of variables.
To use any of the standard functions, the appropriate header file must be included. This is done at the
beginning of the C source file.
For example, to use the printf() function in a program, the line #include <stdio.h> is responsible.
MY FIRST PROGRAM IN C LANGUAGE .
3. main() function:
main() function is a function that must be used in every C program. A function is a sequence of statement
required to perform a specific task. main() function starts the execution of C program. In the above example,
int in front of main() function is the return type of main() function. we will discuss about it in detail later.
The curly braces { } just after the main() function encloses the body of main() function.
4. Compile and Run:
There are many different ways to compile and run a C program. All that is required is a C compiler.
BASIC SYNTAX
• Tokens in C
• the following C statement consists of five tokens −
• printf("Hello, World! n");
1. Bracket- a.() b.{} c.[] d.<>
2. Semicolons- The semicolon is a statement terminator. each individual statement must be ended with a
semicolon. It indicates the end of one logical entity.
Given below are two different statements −
printf("Hello, World! n");
return 0;
BASIC SYNTAX
3. Comments- Comments are like helping text in your C program and they are ignored by the compiler.
There are three types of Comments , they are :
a. /* */ b. // c.///
4. Identifiers- A C identifier is a name used to identify a variable, function, or any other user-defined item. An
identifier starts with a letter A to Z, a to z, or an underscore '_' followed by zero or more letters, underscores,
and digits.
C does not allow punctuation characters such as @, $, and % within identifiers. C is a case-sensitive programming
language. Thus, Manpower and manpower are two different identifiers in C.
Here are some examples of acceptable identifiers −
mohd zara abc move_name a_123
myname50 _temp j a23b9 retVal
BASIC SYNTAX
5. Keywords- The following list shows the reserved words in C. These reserved words may not be used as
constants or variables or any other identifier names.
auto else long switch break
enum register typedef case extern
return union char float short
unsigned const for signed void
continue goto sizeof volatile default
if static while do int
struct Packed double
BASIC SYNTAX
6. Whitespace - A line containing only whitespace, possibly with a comment, is known as a blank line, and
a C compiler totally ignores it.
Whitespace is the term used in C to describe blanks, tabs, newline characters and comments. Whitespace
separates one part of a statement from another and enables the compiler to identify where one element in a
statement, such as int, ends and the next element begins. Therefore, in the following statement −
int age;
DATA TYPES
1. Char
2. unsigned char
3. signed char
4. Int
5. unsigned int
6. Short
7. unsigned short
8. Long
9. unsigned long
10. float
11. double
12. long double
VARIABLES
• Type Description
• Char-Typically a single octet(one byte). This is an integer type.
• Int-The most natural size of integer for the machine.
• Float-A single-precision floating point value.
• Double-A double-precision floating point value.
• Void-Represents the absence of type.
VARIABLE DEFINITION
1. type variable_list;
2. type variable_name = value;
1.EXAMPLE:
• int i, j, k;
• char c, ch;
• float f, salary;
• double d;
2. EXAMPLE:
extern int d = 3, f = 5; // declaration of d and f.
int d = 3, f = 5; // definition and initializing d and f.
byte z = 22; // definition and initializes z.
char x = 'x'; // the variable x has the value 'x'.
VARIABLE DECLARATION
• Example:
// Variable declaration:
extern int a, b;
extern int c;
extern float f;
EXAMPLE:
• #include <stdio.h>
• // Variable declaration:
• extern int a, b;
• extern int c;
• extern float f;
• int main () {
• /* variable definition: */
• int a, b;
• int c;
• float f;
•
• /* actual initialization */
• a = 10;
• b = 20;
•
• c = a + b;
• printf("value of c : %d n", c);
• f = 70.0/3.0;
• printf("value of f : %f n", f);
•
• return 0;
• }
FUNCTION
• // function declaration
• int func();
• int main() {
• // function call
• int i = func();
• }
• // function definition
• int func() {
• return 0;
• }
CONSTANTS
• Defining Constants
• There are two simple ways in C to define constants −
• Using #define preprocessor.
• Using const keyword.
• The #define Preprocessor:
• Given below is the form to use #define preprocessor to define a constant −
#define identifier value
EXAMPLE:
• #include <stdio.h>
• #define LENGTH 10
• #define WIDTH 5
• #define NEWLINE 'n'
• int main()
• {
• int area;
•
• area = LENGTH * WIDTH;
• printf("value of area : %d", area);
• printf("%c", NEWLINE);
• return 0;
• }
THE CONST KEYWORD
• You can use const prefix to declare constants with a specific type as follows −
• #include <stdio.h>
• int main() {
• const int LENGTH = 10;
• const int WIDTH = 5;
• const char NEWLINE = 'n';
• int area;
•
• area = LENGTH * WIDTH;
• printf("value of area : %d", area);
• printf("%c", NEWLINE);
• return 0;
• }
STORAGE CLASSES
• A storage class defines the scope (visibility) and life-time of variables and/or functions within a C
Program. They precede the type that they modify.
• We have four different storage classes in a C program −
• auto
• register
• static
• extern
THE AUTO STORAGE CLASS
• The auto storage class is the default storage class for all local variables.
• {
• int mount;
• auto int month;
• }
• The example above defines two variables with in the same storage class. 'auto' can only be used within
functions, i.e., local variables.
THE REGISTER STORAGE CLASS
• The register storage class is used to define local variables that should be stored in a register instead of
RAM. This means that the variable has a maximum size equal to the register size (usually one word) and
can't have the unary '&' operator applied to it (as it does not have a memory location).
• {
• register int miles;
• }
• The register should only be used for variables that require quick access such as counters. It should also
be noted that defining 'register' does not mean that the variable will be stored in a register. It means that it
MIGHT be stored in a register depending on hardware and implementation restrictions.
THE STATIC STORAGE CLASS
• The static storage class instructs the compiler to keep a local variable in existence during the life-time of
the program instead of creating and destroying it each time it comes into and goes out of scope.
Therefore, making local variables static allows them to maintain their values between function calls.
• The static modifier may also be applied to global variables. When this is done, it causes that variable's
scope to be restricted to the file in which it is declared.
• In C programming, when static is used on a global variable, it causes only one copy of that member to be
shared by all the objects of its class.
THE EXTERN STORAGE CLASS
• The extern storage class is used to give a reference of a global variable that is visible to ALL the program
files. When you use 'extern', the variable cannot be initialized however, it points the variable name at a
storage location that has been previously defined.
• When you have multiple files and you define a global variable or function, which will also be used in
other files, then extern will be used in another file to provide the reference of defined variable or
function. Just for understanding, extern is used to declare a global variable or function in another file.
OPERATORS
• Arithmetic Operators(+,−,*,/,%,++,--)
• Relational Operators(==,!= ,>,<,>=,<=)
• Logical Operators(&& ,||,! )
• Bitwise Operators( &, |, ^, ~,<<,>>)
• Assignment Operators(=,+=,-=,*=,/=,%=,<<=,>>=,&=,^=,|=)
• Misc Operators(sizeof(),&,*,? :)
DECISION MAKING
• Decision making structures require that the programmer
specifies one or more conditions to be evaluated or
tested by the program, along with a statement or
statements to be executed if the condition is determined
to be true, and optionally, other statements to be
executed if the condition is determined to be false.

More Related Content

What's hot

Understanding c file handling functions with examples
Understanding c file handling functions with examplesUnderstanding c file handling functions with examples
Understanding c file handling functions with examples
Muhammed Thanveer M
 
Unit 4
Unit 4Unit 4
Unit 4
siddr
 
Unit 5 dwqb ans
Unit 5 dwqb ansUnit 5 dwqb ans
Unit 5 dwqb ans
Sowri Rajan
 
Clonedigger-Python
Clonedigger-PythonClonedigger-Python
Clonedigger-Python
Sangharsh agarwal
 
Something About Dynamic Linking
Something About Dynamic LinkingSomething About Dynamic Linking
Something About Dynamic Linking
Wang Hsiangkai
 
Unsupervised Machine Learning for clone detection
Unsupervised Machine Learning for clone detectionUnsupervised Machine Learning for clone detection
Unsupervised Machine Learning for clone detection
Valerio Maggio
 
More on Lex
More on LexMore on Lex
More on Lex
Tech_MX
 
File handling-c programming language
File handling-c programming languageFile handling-c programming language
File handling-c programming language
thirumalaikumar3
 
File handling in c
File  handling in cFile  handling in c
File handling in c
thirumalaikumar3
 
Yacc (yet another compiler compiler)
Yacc (yet another compiler compiler)Yacc (yet another compiler compiler)
Yacc (yet another compiler compiler)
omercomail
 
C tutorial
C tutorialC tutorial
C tutorial
Khan Rahimeen
 
Lk module4 file
Lk module4 fileLk module4 file
Lk module4 file
Krishna Nanda
 
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDYC UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
Rajeshkumar Reddy
 
C
CC
Python basics
Python basicsPython basics
Python basics
Hoang Nguyen
 
Data Structure Using C - FILES
Data Structure Using C - FILESData Structure Using C - FILES
Data Structure Using C - FILES
Harish Kamat
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
Võ Hòa
 
Python Session - 4
Python Session - 4Python Session - 4
Python Session - 4
AnirudhaGaikwad4
 
4 text file
4 text file4 text file
4 text file
hasan Mohammad
 
Presentation on C++ programming
Presentation on C++ programming Presentation on C++ programming
Presentation on C++ programming
AditiTibile
 

What's hot (20)

Understanding c file handling functions with examples
Understanding c file handling functions with examplesUnderstanding c file handling functions with examples
Understanding c file handling functions with examples
 
Unit 4
Unit 4Unit 4
Unit 4
 
Unit 5 dwqb ans
Unit 5 dwqb ansUnit 5 dwqb ans
Unit 5 dwqb ans
 
Clonedigger-Python
Clonedigger-PythonClonedigger-Python
Clonedigger-Python
 
Something About Dynamic Linking
Something About Dynamic LinkingSomething About Dynamic Linking
Something About Dynamic Linking
 
Unsupervised Machine Learning for clone detection
Unsupervised Machine Learning for clone detectionUnsupervised Machine Learning for clone detection
Unsupervised Machine Learning for clone detection
 
More on Lex
More on LexMore on Lex
More on Lex
 
File handling-c programming language
File handling-c programming languageFile handling-c programming language
File handling-c programming language
 
File handling in c
File  handling in cFile  handling in c
File handling in c
 
Yacc (yet another compiler compiler)
Yacc (yet another compiler compiler)Yacc (yet another compiler compiler)
Yacc (yet another compiler compiler)
 
C tutorial
C tutorialC tutorial
C tutorial
 
Lk module4 file
Lk module4 fileLk module4 file
Lk module4 file
 
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDYC UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
 
C
CC
C
 
Python basics
Python basicsPython basics
Python basics
 
Data Structure Using C - FILES
Data Structure Using C - FILESData Structure Using C - FILES
Data Structure Using C - FILES
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Python Session - 4
Python Session - 4Python Session - 4
Python Session - 4
 
4 text file
4 text file4 text file
4 text file
 
Presentation on C++ programming
Presentation on C++ programming Presentation on C++ programming
Presentation on C++ programming
 

Similar to C language updated

C language
C languageC language
C language
Arafat Bin Reza
 
Copy of UNIT 2 -- Basics Of Programming.pptx
Copy of UNIT 2 -- Basics Of Programming.pptxCopy of UNIT 2 -- Basics Of Programming.pptx
Copy of UNIT 2 -- Basics Of Programming.pptx
rahulrajbhar06478
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
JStalinAsstProfessor
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
Durga Padma
 
Learning the C Language
Learning the C LanguageLearning the C Language
Learning the C Language
nTier Custom Solutions
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
ManiMala75
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
ManiMala75
 
C programming
C programmingC programming
C programming
PralhadKhanal1
 
Functions in c
Functions in cFunctions in c
Functions in c
sunila tharagaturi
 
C pdf
C pdfC pdf
C pdf
amit9765
 
Rr
RrRr
Rr
VK AG
 
Introduction to the c programming language (amazing and easy book for beginners)
Introduction to the c programming language (amazing and easy book for beginners)Introduction to the c programming language (amazing and easy book for beginners)
Introduction to the c programming language (amazing and easy book for beginners)
mujeeb memon
 
Basic c
Basic cBasic c
Basic c
Veera Karthi
 
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
 
history of c.ppt
history of c.ppthistory of c.ppt
history of c.ppt
arpanabharani
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
kiranrajat
 
unit2.pptx
unit2.pptxunit2.pptx
unit2.pptx
sscprep9
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-sem
Kavita Dagar
 
Chapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptChapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this ppt
ANISHYAPIT
 
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Rohit Singh
 

Similar to C language updated (20)

C language
C languageC language
C language
 
Copy of UNIT 2 -- Basics Of Programming.pptx
Copy of UNIT 2 -- Basics Of Programming.pptxCopy of UNIT 2 -- Basics Of Programming.pptx
Copy of UNIT 2 -- Basics Of Programming.pptx
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
Learning the C Language
Learning the C LanguageLearning the C Language
Learning the C Language
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
 
C programming
C programmingC programming
C programming
 
Functions in c
Functions in cFunctions in c
Functions in c
 
C pdf
C pdfC pdf
C pdf
 
Rr
RrRr
Rr
 
Introduction to the c programming language (amazing and easy book for beginners)
Introduction to the c programming language (amazing and easy book for beginners)Introduction to the c programming language (amazing and easy book for beginners)
Introduction to the c programming language (amazing and easy book for beginners)
 
Basic c
Basic cBasic c
Basic c
 
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
 
history of c.ppt
history of c.ppthistory of c.ppt
history of c.ppt
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
 
unit2.pptx
unit2.pptxunit2.pptx
unit2.pptx
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-sem
 
Chapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this pptChapter-2 edited on Programming in Can refer this ppt
Chapter-2 edited on Programming in Can refer this ppt
 
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)
 

More from Arafat Bin Reza

C# Class Introduction.pptx
C# Class Introduction.pptxC# Class Introduction.pptx
C# Class Introduction.pptx
Arafat Bin Reza
 
C# Class Introduction
C# Class IntroductionC# Class Introduction
C# Class Introduction
Arafat Bin Reza
 
Inventory music shop management
Inventory music shop managementInventory music shop management
Inventory music shop management
Arafat Bin Reza
 
C language 3
C language 3C language 3
C language 3
Arafat Bin Reza
 
C language 2
C language 2C language 2
C language 2
Arafat Bin Reza
 
Sudoku solve rmain
Sudoku solve rmainSudoku solve rmain
Sudoku solve rmain
Arafat Bin Reza
 
string , pointer
string , pointerstring , pointer
string , pointer
Arafat Bin Reza
 
final presentation of sudoku solver project
final presentation of sudoku solver projectfinal presentation of sudoku solver project
final presentation of sudoku solver project
Arafat Bin Reza
 

More from Arafat Bin Reza (8)

C# Class Introduction.pptx
C# Class Introduction.pptxC# Class Introduction.pptx
C# Class Introduction.pptx
 
C# Class Introduction
C# Class IntroductionC# Class Introduction
C# Class Introduction
 
Inventory music shop management
Inventory music shop managementInventory music shop management
Inventory music shop management
 
C language 3
C language 3C language 3
C language 3
 
C language 2
C language 2C language 2
C language 2
 
Sudoku solve rmain
Sudoku solve rmainSudoku solve rmain
Sudoku solve rmain
 
string , pointer
string , pointerstring , pointer
string , pointer
 
final presentation of sudoku solver project
final presentation of sudoku solver projectfinal presentation of sudoku solver project
final presentation of sudoku solver project
 

Recently uploaded

Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 

Recently uploaded (20)

Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 

C language updated

  • 2. INTRODUCTION OF C LANGUAGE • What is C Language? • C is a general-purpose, procedural, imperative computer programming language. • C is the most widely used computer language. • If you are new to programming, C is a good choice to start your programming journey.
  • 3. INTRODUCTION OF C LANGUAGE • C has now become a widely used professional language for various reasons − • Easy to learn • Structured language • It produces efficient programs • It can handle low-level activities • It can be compiled on a variety of computer platforms
  • 4. INTRODUCTION OF C LANGUAGE • Different parts of C program. • Pre-processor • Header file • Function • Variables • expression • Comment
  • 5. MY FIRST PROGRAM IN C LANGUAGE . • #include <stdio.h> • • int main() • { • /* my first program in C */ • printf("Hello, World! n"); • • return 0; • }
  • 6. MY FIRST PROGRAM IN C LANGUAGE . 1. Pre-processor : #include, the first word of any C program. It is also known as pre-processor. The main work of pre- processor is to initialize the environment of program, i.e to link the program with the header file <stdio.h>. 2. Header file: Header file is a collection of built-in functions that help us in our program. Header files contain definitions of functions and variables which can be incorporated into any C program by pre-processor #include statement. Standard header files are provided with each compiler, and cover a range of areas like string handling, mathematical functions, data conversion, printing and reading of variables. To use any of the standard functions, the appropriate header file must be included. This is done at the beginning of the C source file. For example, to use the printf() function in a program, the line #include <stdio.h> is responsible.
  • 7. MY FIRST PROGRAM IN C LANGUAGE . 3. main() function: main() function is a function that must be used in every C program. A function is a sequence of statement required to perform a specific task. main() function starts the execution of C program. In the above example, int in front of main() function is the return type of main() function. we will discuss about it in detail later. The curly braces { } just after the main() function encloses the body of main() function. 4. Compile and Run: There are many different ways to compile and run a C program. All that is required is a C compiler.
  • 8. BASIC SYNTAX • Tokens in C • the following C statement consists of five tokens − • printf("Hello, World! n"); 1. Bracket- a.() b.{} c.[] d.<> 2. Semicolons- The semicolon is a statement terminator. each individual statement must be ended with a semicolon. It indicates the end of one logical entity. Given below are two different statements − printf("Hello, World! n"); return 0;
  • 9. BASIC SYNTAX 3. Comments- Comments are like helping text in your C program and they are ignored by the compiler. There are three types of Comments , they are : a. /* */ b. // c./// 4. Identifiers- A C identifier is a name used to identify a variable, function, or any other user-defined item. An identifier starts with a letter A to Z, a to z, or an underscore '_' followed by zero or more letters, underscores, and digits. C does not allow punctuation characters such as @, $, and % within identifiers. C is a case-sensitive programming language. Thus, Manpower and manpower are two different identifiers in C. Here are some examples of acceptable identifiers − mohd zara abc move_name a_123 myname50 _temp j a23b9 retVal
  • 10. BASIC SYNTAX 5. Keywords- The following list shows the reserved words in C. These reserved words may not be used as constants or variables or any other identifier names. auto else long switch break enum register typedef case extern return union char float short unsigned const for signed void continue goto sizeof volatile default if static while do int struct Packed double
  • 11. BASIC SYNTAX 6. Whitespace - A line containing only whitespace, possibly with a comment, is known as a blank line, and a C compiler totally ignores it. Whitespace is the term used in C to describe blanks, tabs, newline characters and comments. Whitespace separates one part of a statement from another and enables the compiler to identify where one element in a statement, such as int, ends and the next element begins. Therefore, in the following statement − int age;
  • 12. DATA TYPES 1. Char 2. unsigned char 3. signed char 4. Int 5. unsigned int 6. Short 7. unsigned short 8. Long 9. unsigned long 10. float 11. double 12. long double
  • 13. VARIABLES • Type Description • Char-Typically a single octet(one byte). This is an integer type. • Int-The most natural size of integer for the machine. • Float-A single-precision floating point value. • Double-A double-precision floating point value. • Void-Represents the absence of type.
  • 14. VARIABLE DEFINITION 1. type variable_list; 2. type variable_name = value; 1.EXAMPLE: • int i, j, k; • char c, ch; • float f, salary; • double d; 2. EXAMPLE: extern int d = 3, f = 5; // declaration of d and f. int d = 3, f = 5; // definition and initializing d and f. byte z = 22; // definition and initializes z. char x = 'x'; // the variable x has the value 'x'.
  • 15. VARIABLE DECLARATION • Example: // Variable declaration: extern int a, b; extern int c; extern float f;
  • 16. EXAMPLE: • #include <stdio.h> • // Variable declaration: • extern int a, b; • extern int c; • extern float f; • int main () { • /* variable definition: */ • int a, b; • int c; • float f; • • /* actual initialization */ • a = 10; • b = 20; • • c = a + b; • printf("value of c : %d n", c); • f = 70.0/3.0; • printf("value of f : %f n", f); • • return 0; • }
  • 17. FUNCTION • // function declaration • int func(); • int main() { • // function call • int i = func(); • } • // function definition • int func() { • return 0; • }
  • 18. CONSTANTS • Defining Constants • There are two simple ways in C to define constants − • Using #define preprocessor. • Using const keyword. • The #define Preprocessor: • Given below is the form to use #define preprocessor to define a constant − #define identifier value
  • 19. EXAMPLE: • #include <stdio.h> • #define LENGTH 10 • #define WIDTH 5 • #define NEWLINE 'n' • int main() • { • int area; • • area = LENGTH * WIDTH; • printf("value of area : %d", area); • printf("%c", NEWLINE); • return 0; • }
  • 20. THE CONST KEYWORD • You can use const prefix to declare constants with a specific type as follows − • #include <stdio.h> • int main() { • const int LENGTH = 10; • const int WIDTH = 5; • const char NEWLINE = 'n'; • int area; • • area = LENGTH * WIDTH; • printf("value of area : %d", area); • printf("%c", NEWLINE); • return 0; • }
  • 21. STORAGE CLASSES • A storage class defines the scope (visibility) and life-time of variables and/or functions within a C Program. They precede the type that they modify. • We have four different storage classes in a C program − • auto • register • static • extern
  • 22. THE AUTO STORAGE CLASS • The auto storage class is the default storage class for all local variables. • { • int mount; • auto int month; • } • The example above defines two variables with in the same storage class. 'auto' can only be used within functions, i.e., local variables.
  • 23. THE REGISTER STORAGE CLASS • The register storage class is used to define local variables that should be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and can't have the unary '&' operator applied to it (as it does not have a memory location). • { • register int miles; • } • The register should only be used for variables that require quick access such as counters. It should also be noted that defining 'register' does not mean that the variable will be stored in a register. It means that it MIGHT be stored in a register depending on hardware and implementation restrictions.
  • 24. THE STATIC STORAGE CLASS • The static storage class instructs the compiler to keep a local variable in existence during the life-time of the program instead of creating and destroying it each time it comes into and goes out of scope. Therefore, making local variables static allows them to maintain their values between function calls. • The static modifier may also be applied to global variables. When this is done, it causes that variable's scope to be restricted to the file in which it is declared. • In C programming, when static is used on a global variable, it causes only one copy of that member to be shared by all the objects of its class.
  • 25. THE EXTERN STORAGE CLASS • The extern storage class is used to give a reference of a global variable that is visible to ALL the program files. When you use 'extern', the variable cannot be initialized however, it points the variable name at a storage location that has been previously defined. • When you have multiple files and you define a global variable or function, which will also be used in other files, then extern will be used in another file to provide the reference of defined variable or function. Just for understanding, extern is used to declare a global variable or function in another file.
  • 26. OPERATORS • Arithmetic Operators(+,−,*,/,%,++,--) • Relational Operators(==,!= ,>,<,>=,<=) • Logical Operators(&& ,||,! ) • Bitwise Operators( &, |, ^, ~,<<,>>) • Assignment Operators(=,+=,-=,*=,/=,%=,<<=,>>=,&=,^=,|=) • Misc Operators(sizeof(),&,*,? :)
  • 27. DECISION MAKING • Decision making structures require that the programmer specifies one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.