SlideShare a Scribd company logo
1 of 26
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
• A C program basically consists of the following parts −
• Preprocessor Commands
• Functions
• Variables
• Statements & Expressions
• Comments
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 .
Let us take a look at the various parts of the above program −
1. The first line of the program #include <stdio.h> is a preprocessor command, which tells a C compiler to
include stdio.h file before going to actual compilation.
2. The next line int main() is the main function where the program execution begins.
3. The next line /*...*/ will be ignored by the compiler and it has been put to add additional comments in
the program. So such lines are called comments in the program.
4. The next line printf(...) is another function available in C which causes the message "Hello, World!" to
be displayed on the screen.
5. The next line return 0; terminates the main() function and returns the value 0.
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

User_Defined_Functions_ppt_slideshare.
User_Defined_Functions_ppt_slideshare.User_Defined_Functions_ppt_slideshare.
User_Defined_Functions_ppt_slideshare.NabeelaNousheen
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageRakesh Roshan
 
C language for Semester Exams for Engineers
C language for Semester Exams for Engineers C language for Semester Exams for Engineers
C language for Semester Exams for Engineers Appili Vamsi Krishna
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)sachindane
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semKavita Dagar
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programminggajendra singh
 
Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch casesMeoRamos
 
Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Rumman Ansari
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Functionimtiazalijoono
 
Advanced C Language for Engineering
Advanced C Language for EngineeringAdvanced C Language for Engineering
Advanced C Language for EngineeringVincenzo De Florio
 
OpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpen Gurukul
 

What's hot (20)

C language
C languageC language
C language
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
User_Defined_Functions_ppt_slideshare.
User_Defined_Functions_ppt_slideshare.User_Defined_Functions_ppt_slideshare.
User_Defined_Functions_ppt_slideshare.
 
structure of a c program
structure of a c programstructure of a c program
structure of a c program
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
 
Storage classess of C progamming
Storage classess of C progamming Storage classess of C progamming
Storage classess of C progamming
 
C language for Semester Exams for Engineers
C language for Semester Exams for Engineers C language for Semester Exams for Engineers
C language for Semester Exams for Engineers
 
C language ppt
C language pptC language ppt
C language ppt
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-sem
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch cases
 
Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Basic c programming and explanation PPT1
Basic c programming and explanation PPT1
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
 
Ch4 Expressions
Ch4 ExpressionsCh4 Expressions
Ch4 Expressions
 
Ch9 Functions
Ch9 FunctionsCh9 Functions
Ch9 Functions
 
The smartpath information systems c pro
The smartpath information systems c proThe smartpath information systems c pro
The smartpath information systems c pro
 
Advanced C Language for Engineering
Advanced C Language for EngineeringAdvanced C Language for Engineering
Advanced C Language for Engineering
 
Cnotes
CnotesCnotes
Cnotes
 
OpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpenGurukul : Language : C Programming
OpenGurukul : Language : C Programming
 

Similar to Learn C Programming with Arafat Bin Reza

c-introduction.pptx
c-introduction.pptxc-introduction.pptx
c-introduction.pptxMangala R
 
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.pptxrahulrajbhar06478
 
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 pptJStalinAsstProfessor
 
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 pptANISHYAPIT
 
67404923-C-Programming-Tutorials-Doc.pdf
67404923-C-Programming-Tutorials-Doc.pdf67404923-C-Programming-Tutorials-Doc.pdf
67404923-C-Programming-Tutorials-Doc.pdfRajb54
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptxMark82418
 
Unit-1 (introduction to c language).pptx
Unit-1 (introduction to c language).pptxUnit-1 (introduction to c language).pptx
Unit-1 (introduction to c language).pptxsaivasu4
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.pptManiMala75
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.pptManiMala75
 
C programming language tutorial
C programming language tutorialC programming language tutorial
C programming language tutorialSURBHI SAROHA
 
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 Learn C Programming with Arafat Bin Reza (20)

C language updated
C language updatedC language updated
C language updated
 
c-introduction.pptx
c-introduction.pptxc-introduction.pptx
c-introduction.pptx
 
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
 
Learning the C Language
Learning the C LanguageLearning the C Language
Learning the C Language
 
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
 
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
 
67404923-C-Programming-Tutorials-Doc.pdf
67404923-C-Programming-Tutorials-Doc.pdf67404923-C-Programming-Tutorials-Doc.pdf
67404923-C-Programming-Tutorials-Doc.pdf
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
Unit-1 (introduction to c language).pptx
Unit-1 (introduction to c language).pptxUnit-1 (introduction to c language).pptx
Unit-1 (introduction to c language).pptx
 
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
 
Basic c
Basic cBasic c
Basic c
 
C programming language tutorial
C programming language tutorialC programming language tutorial
C programming language tutorial
 
C for Engineers
C for EngineersC for Engineers
C for Engineers
 
C language unit-1
C language unit-1C language unit-1
C language unit-1
 
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDYC LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
 
C languaGE UNIT-1
C languaGE UNIT-1C languaGE UNIT-1
C languaGE UNIT-1
 
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)
 
C programming
C programmingC programming
C programming
 
Rr
RrRr
Rr
 

More from Arafat Bin Reza

More from Arafat Bin Reza (7)

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

UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 

Recently uploaded (20)

UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 

Learn C Programming with Arafat Bin Reza

  • 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 • A C program basically consists of the following parts − • Preprocessor Commands • Functions • Variables • Statements & Expressions • Comments
  • 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 . Let us take a look at the various parts of the above program − 1. The first line of the program #include <stdio.h> is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation. 2. The next line int main() is the main function where the program execution begins. 3. The next line /*...*/ will be ignored by the compiler and it has been put to add additional comments in the program. So such lines are called comments in the program. 4. The next line printf(...) is another function available in C which causes the message "Hello, World!" to be displayed on the screen. 5. The next line return 0; terminates the main() function and returns the value 0.
  • 7. 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;
  • 8. 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
  • 9. 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
  • 10. 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;
  • 11. 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
  • 12. 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.
  • 13. 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'.
  • 14. VARIABLE DECLARATION • Example: // Variable declaration: extern int a, b; extern int c; extern float f;
  • 15. 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; • }
  • 16. FUNCTION • // function declaration • int func(); • int main() { • // function call • int i = func(); • } • // function definition • int func() { • return 0; • }
  • 17. 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
  • 18. 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; • }
  • 19. 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; • }
  • 20. 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
  • 21. 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.
  • 22. 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.
  • 23. 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.
  • 24. 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.
  • 25. OPERATORS • Arithmetic Operators(+,−,*,/,%,++,--) • Relational Operators(==,!= ,>,<,>=,<=) • Logical Operators(&& ,||,! ) • Bitwise Operators( &, |, ^, ~,<<,>>) • Assignment Operators(=,+=,-=,*=,/=,%=,<<=,>>=,&=,^=,|=) • Misc Operators(sizeof(),&,*,? :)
  • 26. 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.