SlideShare a Scribd company logo
C – Language History
 C language is a structure oriented programming language, was developed
at Bell Laboratories in 1972 by Dennis Ritchie
 C language features were derived from earlier language called “B” (Basic
CombinedProgramming Language – BCPL)
 C language was invented for implementing UNIX operating system
 In 1978, Dennis Ritchie and Brian Kernighan published the first edition
“The C Programming Language” and commonly known as K&R C
 In 1983, the American National Standards Institute (ANSI) established a
committee to provide a modern, comprehensive definition of C. The
resulting definition, the ANSI standard, or “ANSI C”, was completed late
1988.
 Operating systems, C compiler and all UNIX application programs are
written in C language
 It is also called as procedure oriented programming language
 C language is reliable, simple and easy to use.
 C has been coded in assembly language
Uses of C language:
C language is used for developing system applications that forms major
portion of operating systems such as Windows, UNIX and Linux. Below
are some examples of C being used?
 Database systems
 Graphics packages
Word processors
 Operating system development
 Compilers and Assemblers
 Network drivers
 Interpreters
Which level the C language is belonging to?
S.no High Level Middle Level Low Level
1
High level
languages
provides almost
Middle level
languages don’t
provide all the
Low level
languages
provides
everything that
the programmer
might need to
do as already
built into the
language
built-in functions
found in high
level languages,
but provides all
building blocks
that we need to
produce the
result we want
nothing other
than access
to the
machines
basic
instruction
set
2
Examples:
Java, Python
C, C++ Assembler
C language is a structured language
S.no
Structure
oriented
Object oriented Non structure
1
In this type of
language, large
programs are
divided into
small programs
called functions
In this type of
language,
programs are
divided into
objects
There is no
specific
structure for
programming
this language
2
Prime focus is
on functions
and procedures
that operate on
data
Prime focus is
on the data
that is being
operated and
not on the
functions or
procedures
N/A
3
Data moves
freely around
the systems
from one
function to
another
Data is hidden
and cannot be
accessed by
external
functions
N/A
4
Program
structure
follows “Top
Down
Approach”
Program
structure
follows “Bottom
UP Approach”
N/A
5
Examples:
C, Pascal,
ALGOL and
Modula-2
C++, JAVA and
C# (C sharp)
BASIC, COBOL,
FORTRAN
Key points to remember:
1. C language is structured, middle level programming language developed
by Dennis Ritchie
2. Operating system programs such as Windows, Unix, Linux are written by
C language
3. C89/C90 and C99 are two standardized editions of C language
4. C has been written in assembly language
C – printf and scanf
 printf() and scanf() functions are inbuilt library functions in C which are
available in C library by default. These functions are declared and related
macros are defined in “stdio.h” which is a header file.
 We have to include “stdio.h” file as shown in below C program to make
use of these printf() and scanf() library functions.
1. C printf() function:
 printf() function is used to print the “character, string, float, integer,
octal and hexadecimal values” onto the output screen.
 We use printf() function with %d format specifier to display the value
of an integer variable.
 Similarly %c is used to display character, %f for float variable, %s for
string variable, %lf for double and %x for hexadecimal variable.
 To generate a newline,we use “n” in C printf() statement.
Note:
 C language is case sensitive. For example, printf() and scanf() are
different from Printf() and Scanf(). All characters in printf() and
scanf() functions must be in lower case.
#include <stdio.h>
int main()
{
char ch = 'A';
char str[20] = "NIIT.com";
float flt = 10.234;
int no = 150;
double dbl = 20.123456;
printf("Character is %c n", ch);
printf("String is %s n" , str);
printf("Float value is %f n", flt);
printf("Integer value is %dn" , no);
printf("Double value is %lf n", dbl);
printf("Octal value is %o n", no);
printf("Hexadecimal value is %x n", no);
return 0;
}
Output:
Character is A
String is NIIT.COM
Float value is 10.234000
Integer value is 150
Double value is 20.123456
Octal value is 226
Hexadecimal value is 96
You can see the output with the same data which are placed within the
double quotes of printf statement in the program except
 %d got replaced by value of an integer variable (no),
 %c got replaced by value of a character variable (ch),
 %f got replaced by value of a float variable (flt),
 %lf got replaced by value of a double variable (dbl),
 %s got replaced by value of a string variable (str),
 %o got replaced by a octal value corresponding to integer variable
(no),
 %x got replaced by a hexadecimal value corresponding to integer
variable
 n got replaced by a newline.
2. C scanf() function:
 scanf() function is used to read character, string, numeric data from
keyboard
 Consider below example program where user enters a character. This
value is assigned to the variable “ch” and then displayed.
 Then, user enters a string and this value is assigned to the
variable”str” and then displayed.
Example program for printf() and scanf() functions in C:
#include <stdio.h>
int main()
{
char ch;
char str[100];
printf("Enter any character n");
scanf("%c", &ch);
printf("Entered character is %c n", ch);
printf("Enter any string ( upto 100 character ) n");
scanf("%s", &str);
printf("Entered string is %s n", str);
}
Output:

 The format specifier %d is used in scanf () statement. So that, the
value entered is received as an integer and %s for string.
 Ampersand is used before variable name “ch” in scanf () statement as
&ch.
 It is just like in a pointer which is used to point to the variable. For
more information about how pointer works
C – Data Types
 C data types are defined as the data storage format that a variable can
store a data to perform a specific operation.
 Data types are used to define a variable before to use in a program.
 Size of variable, constant and array are determined by data types.
C – data types:
There are four data types in C language. They are,
S.no Types Data Types
1 Basic data types int, char, float, double
2
Enumeration data
type
enum
3 Derived data type
pointer, array, structure,
union
4 Void data type void
Enter any character
a
Entered character is a
Enter any string ( upto 100 character )
hai
Entered string is hai
1. Basic data types in C:
1.1. Integer data type:
 Integer data type allows a variable to store numeric values.
 “int” keyword is used to refer integer data type.
 The storage size of int data type is 2 or 4 or 8 byte.
 It varies depend upon the processor in the CPU that we use. If we are
using 16 bit processor, 2 byte (16 bit) of memory will be allocated for int
data type.
 Like wise, 4 byte (32 bit) of memory for 32 bit processor and 8 byte (64
bit) of memory for 64 bit processor is allocated for int datatype.
 int (2 byte) can store values from -32,768 to +32,767
 int (4 byte) can store values from -2,147,483,648 to +2,147,483,647.
 If you want to use the integer value that crosses the above limit, you can
go for “long int” and “long long int” for which the limits are very high.
Note:
 We can’t store decimal values using int data type.
 If we use int data type to store decimal values, decimal values will be
truncated and we will get only whole number.
 In this case, float data type can be used to store decimal values in a
variable.
1.2. Character data type:
 Character data type allows a variable to store only one character.
 Storage size of character data type is 1. We can store only one character
using character data type.
 “char” keyword is used to refer character data type.
 For example, ‘A’ can be stored using char datatype. You can’t store more
than one character using char data type.
 Please refer C – Strings topic to know how to store more than one
characters in a variable.
1.3. Floating point data type:
Floating point data type consists of 2 types. They are,
1. float
2. double
1. float:
 Float data type allows a variable to store decimal values.
 Storage size of float data type is 4. This also varies depend upon the
processor in the CPU as “int” data type.
 We can use up-to 6 digits after decimal using float data type.
 For example, 10.456789 can be stored in a variable using float data type.
2. double:
 Double data type is also same as float data type which allows up-to 10
digits after decimal.
 The range for double datatype is from 1E–37 to 1E+37.
1.3.1. sizeof () function in C:
sizeof () function is used to find the memory space allocated for each C data
types.
#include <stdio.h>
#include <limits.h>
int main()
{
int a;
char b;
float c;
double d;
printf("Storage size for int data type:%d n",sizeof(a));
printf("Storage size for char data type:%d n",sizeof(b));
printf("Storage size for float data type:%d n",sizeof(c));
printf("Storage size for double data type:%dn",sizeof(d));
return 0;
}
Output:
Storage size for int data type:4
Storage size for char data type:1
Storage size for float data type:4
Storage size for double data type:8
1.3.2. Modifiers in C:
 The amount of memory space to be allocated for a variable is derived by
modifiers.
 Modifiers are prefixed with basic data types to modify (either increase or
decrease) the amount of storage space allocated to a variable.
 For example, storage space for int data type is 4 byte for 32 bit
processor. We can increase the range by using long int which is 8
byte. We can decrease the range by using short int which is 2 byte.
 There are 5 modifiers available in C language. They are,
1. short
2. long
3. signed
4. unsigned
5. long long
 Below table gives the detail about the storage size of each C basic data
type in 16 bit processor.
Please keep in mind that storage size and range for int and float datatype
will vary depend on the CPU processor (8,16, 32 and 64 bit)
S.No C Data types storage Range
Size
1 char 1 –127 to 127
2 int 2 –32,767 to 32,767
3 float 4
1E–37 to 1E+37 with six digits of
precision
4 double 8
1E–37 to 1E+37 with ten digits
of precision
5
long double
10
1E–37 to 1E+37 with ten digits
of precision
6 long int 4
–2,147,483,647 to
2,147,483,647
7 short int 2 –32,767 to 32,767
8
unsigned short
int
2 0 to 65,535
9 signed short int 2 –32,767 to 32,767
10 long long int 8
–(2power(63) –1) to 2(power)63
–1
11 signed long int 4
–2,147,483,647 to
2,147,483,647
12
unsigned long
int
4 0 to 4,294,967,295
13
unsigned long
long int
8 2(power)64 –1
Key words
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
Ad

More Related Content

What's hot (20)

Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
programming9
 
Python-Functions.pptx
Python-Functions.pptxPython-Functions.pptx
Python-Functions.pptx
Karudaiyar Ganapathy
 
Looping statements
Looping statementsLooping statements
Looping statements
Chukka Nikhil Chakravarthy
 
Types of Statements in Python Programming Language
Types of Statements in Python Programming LanguageTypes of Statements in Python Programming Language
Types of Statements in Python Programming Language
Explore Skilled
 
C functions
C functionsC functions
C functions
University of Potsdam
 
Header files in c
Header files in cHeader files in c
Header files in c
HoneyChintal
 
Managing I/O in c++
Managing I/O in c++Managing I/O in c++
Managing I/O in c++
Pranali Chaudhari
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
Thooyavan Venkatachalam
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
Kamal Acharya
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
Neeru Mittal
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
ABHISHEK fulwadhwa
 
C programming basics
C  programming basicsC  programming basics
C programming basics
argusacademy
 
C presentation
C presentationC presentation
C presentation
APSMIND TECHNOLOGY PVT LTD.
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
MOHIT AGARWAL
 
INLINE FUNCTION IN C++
INLINE FUNCTION IN C++INLINE FUNCTION IN C++
INLINE FUNCTION IN C++
Vraj Patel
 
Call by value
Call by valueCall by value
Call by value
Dharani G
 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
Madishetty Prathibha
 
C programming - String
C programming - StringC programming - String
C programming - String
Achyut Devkota
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
v_jk
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
Pranali Chaudhari
 

Viewers also liked (20)

C programming tutorial for beginners
C programming tutorial for beginnersC programming tutorial for beginners
C programming tutorial for beginners
Thiyagarajan Soundhiran
 
Introduction to programming with c,
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,
Hossain Md Shakhawat
 
C ppt
C pptC ppt
C ppt
jasmeen kr
 
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6
Rumman Ansari
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
JavaTpoint.Com
 
Medicaid organization profile
Medicaid organization profileMedicaid organization profile
Medicaid organization profile
Anurag Byala
 
Основи мови Ci
Основи мови CiОснови мови Ci
Основи мови Ci
Escuela
 
7g
7g7g
7g
96_mavg
 
01 iec t1_s1_oo_ps_session_01
01 iec t1_s1_oo_ps_session_0101 iec t1_s1_oo_ps_session_01
01 iec t1_s1_oo_ps_session_01
Niit Care
 
C programming
C programmingC programming
C programming
Anurag Byala
 
03 the c language
03 the c language03 the c language
03 the c language
arafatmirza
 
Union in C programming
Union in C programmingUnion in C programming
Union in C programming
Kamal Acharya
 
Li fi
Li fiLi fi
Li fi
Chukka Nikhil Chakravarthy
 
C string
C stringC string
C string
University of Potsdam
 
Strings in C
Strings in CStrings in C
Strings in C
Kamal Acharya
 
Structure in C
Structure in CStructure in C
Structure in C
Fazle Rabbi Ador
 
SAP BI 7 security concepts
SAP BI 7 security conceptsSAP BI 7 security concepts
SAP BI 7 security concepts
Siva Pradeep Bolisetti
 
Structure in c
Structure in cStructure in c
Structure in c
baabtra.com - No. 1 supplier of quality freshers
 
Structure in c
Structure in cStructure in c
Structure in c
Prabhu Govind
 
Ad

Similar to C tutorial (20)

c_pro_introduction.pptx
c_pro_introduction.pptxc_pro_introduction.pptx
c_pro_introduction.pptx
RohitRaj744272
 
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptxPPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
ZwecklosSe
 
Theory1&amp;2
Theory1&amp;2Theory1&amp;2
Theory1&amp;2
Dr.M.Karthika parthasarathy
 
Programming_in_C_language_Unit5.pptx course ATOT
Programming_in_C_language_Unit5.pptx course ATOTProgramming_in_C_language_Unit5.pptx course ATOT
Programming_in_C_language_Unit5.pptx course ATOT
jagmeetsidhu0012
 
Programming in C - interview questions.pdf
Programming in C - interview questions.pdfProgramming in C - interview questions.pdf
Programming in C - interview questions.pdf
SergiuMatei7
 
C_Progragramming_language_Tutorial_ppt_f.pptx
C_Progragramming_language_Tutorial_ppt_f.pptxC_Progragramming_language_Tutorial_ppt_f.pptx
C_Progragramming_language_Tutorial_ppt_f.pptx
maaithilisaravanan
 
datypes , operators in c,variables in clanguage formatting input and out put
datypes , operators in c,variables in clanguage formatting input  and out putdatypes , operators in c,variables in clanguage formatting input  and out put
datypes , operators in c,variables in clanguage formatting input and out put
MdAmreen
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
AnkitaVerma776806
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
amol_chavan
 
Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptx
Rowank2
 
Data types
Data typesData types
Data types
Sachin Satwaskar
 
basic C PROGRAMMING for first years .pptx
basic C  PROGRAMMING for first years  .pptxbasic C  PROGRAMMING for first years  .pptx
basic C PROGRAMMING for first years .pptx
divyasindhu040
 
2. introduction of a c program
2. introduction of a c program2. introduction of a c program
2. introduction of a c program
Alamgir Hossain
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language
Rowank2
 
Basic c
Basic cBasic c
Basic c
Veera Karthi
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
JAYA
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
MOHAMAD NOH AHMAD
 
Programming in c
Programming in cProgramming in c
Programming in c
vinothinisureshbabu
 
C Language ppt create by Anand & Sager.pptx
C Language ppt create by Anand & Sager.pptxC Language ppt create by Anand & Sager.pptx
C Language ppt create by Anand & Sager.pptx
kumaranand07297
 
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
imtiazalijoono
 
c_pro_introduction.pptx
c_pro_introduction.pptxc_pro_introduction.pptx
c_pro_introduction.pptx
RohitRaj744272
 
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptxPPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
ZwecklosSe
 
Programming_in_C_language_Unit5.pptx course ATOT
Programming_in_C_language_Unit5.pptx course ATOTProgramming_in_C_language_Unit5.pptx course ATOT
Programming_in_C_language_Unit5.pptx course ATOT
jagmeetsidhu0012
 
Programming in C - interview questions.pdf
Programming in C - interview questions.pdfProgramming in C - interview questions.pdf
Programming in C - interview questions.pdf
SergiuMatei7
 
C_Progragramming_language_Tutorial_ppt_f.pptx
C_Progragramming_language_Tutorial_ppt_f.pptxC_Progragramming_language_Tutorial_ppt_f.pptx
C_Progragramming_language_Tutorial_ppt_f.pptx
maaithilisaravanan
 
datypes , operators in c,variables in clanguage formatting input and out put
datypes , operators in c,variables in clanguage formatting input  and out putdatypes , operators in c,variables in clanguage formatting input  and out put
datypes , operators in c,variables in clanguage formatting input and out put
MdAmreen
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
AnkitaVerma776806
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
amol_chavan
 
Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptx
Rowank2
 
basic C PROGRAMMING for first years .pptx
basic C  PROGRAMMING for first years  .pptxbasic C  PROGRAMMING for first years  .pptx
basic C PROGRAMMING for first years .pptx
divyasindhu040
 
2. introduction of a c program
2. introduction of a c program2. introduction of a c program
2. introduction of a c program
Alamgir Hossain
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language
Rowank2
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
JAYA
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
MOHAMAD NOH AHMAD
 
C Language ppt create by Anand & Sager.pptx
C Language ppt create by Anand & Sager.pptxC Language ppt create by Anand & Sager.pptx
C Language ppt create by Anand & Sager.pptx
kumaranand07297
 
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
imtiazalijoono
 
Ad

More from Chukka Nikhil Chakravarthy (18)

DESIGN AND DEVELOPMENT OF SOLAR CHARGE CONTROLLER WITH SUN TRACKING
DESIGN AND DEVELOPMENT OF SOLAR CHARGE CONTROLLER WITH SUN TRACKINGDESIGN AND DEVELOPMENT OF SOLAR CHARGE CONTROLLER WITH SUN TRACKING
DESIGN AND DEVELOPMENT OF SOLAR CHARGE CONTROLLER WITH SUN TRACKING
Chukka Nikhil Chakravarthy
 
extint,endangered, endmic species
extint,endangered, endmic speciesextint,endangered, endmic species
extint,endangered, endmic species
Chukka Nikhil Chakravarthy
 
types of resources
types of resourcestypes of resources
types of resources
Chukka Nikhil Chakravarthy
 
ISOMETRIC DRAWING
ISOMETRIC DRAWINGISOMETRIC DRAWING
ISOMETRIC DRAWING
Chukka Nikhil Chakravarthy
 
ORTHOGRAPHIC PROJECTIONS
ORTHOGRAPHIC PROJECTIONSORTHOGRAPHIC PROJECTIONS
ORTHOGRAPHIC PROJECTIONS
Chukka Nikhil Chakravarthy
 
projection of solide
projection of solideprojection of solide
projection of solide
Chukka Nikhil Chakravarthy
 
projection of solids
projection of solidsprojection of solids
projection of solids
Chukka Nikhil Chakravarthy
 
projection of planes
projection of planesprojection of planes
projection of planes
Chukka Nikhil Chakravarthy
 
projection of planes
projection of planesprojection of planes
projection of planes
Chukka Nikhil Chakravarthy
 
angle of projections
angle of projectionsangle of projections
angle of projections
Chukka Nikhil Chakravarthy
 
construction of ellipse and scales
construction of ellipse and scalesconstruction of ellipse and scales
construction of ellipse and scales
Chukka Nikhil Chakravarthy
 
Unit 8
Unit 8Unit 8
Unit 8
Chukka Nikhil Chakravarthy
 
Unit 7
Unit 7Unit 7
Unit 7
Chukka Nikhil Chakravarthy
 
Unit 6
Unit 6Unit 6
Unit 6
Chukka Nikhil Chakravarthy
 
Unit 5
Unit 5Unit 5
Unit 5
Chukka Nikhil Chakravarthy
 
C – operators and expressions
C – operators and expressionsC – operators and expressions
C – operators and expressions
Chukka Nikhil Chakravarthy
 
Arrays
ArraysArrays
Arrays
Chukka Nikhil Chakravarthy
 
7 wonders of world(new)
7 wonders of world(new)7 wonders of world(new)
7 wonders of world(new)
Chukka Nikhil Chakravarthy
 

Recently uploaded (20)

Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 

C tutorial

  • 1. C – Language History  C language is a structure oriented programming language, was developed at Bell Laboratories in 1972 by Dennis Ritchie  C language features were derived from earlier language called “B” (Basic CombinedProgramming Language – BCPL)  C language was invented for implementing UNIX operating system  In 1978, Dennis Ritchie and Brian Kernighan published the first edition “The C Programming Language” and commonly known as K&R C  In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or “ANSI C”, was completed late 1988.  Operating systems, C compiler and all UNIX application programs are written in C language  It is also called as procedure oriented programming language  C language is reliable, simple and easy to use.  C has been coded in assembly language Uses of C language: C language is used for developing system applications that forms major portion of operating systems such as Windows, UNIX and Linux. Below are some examples of C being used?  Database systems  Graphics packages Word processors  Operating system development  Compilers and Assemblers  Network drivers  Interpreters Which level the C language is belonging to? S.no High Level Middle Level Low Level 1 High level languages provides almost Middle level languages don’t provide all the Low level languages provides
  • 2. everything that the programmer might need to do as already built into the language built-in functions found in high level languages, but provides all building blocks that we need to produce the result we want nothing other than access to the machines basic instruction set 2 Examples: Java, Python C, C++ Assembler C language is a structured language S.no Structure oriented Object oriented Non structure 1 In this type of language, large programs are divided into small programs called functions In this type of language, programs are divided into objects There is no specific structure for programming this language 2 Prime focus is on functions and procedures that operate on data Prime focus is on the data that is being operated and not on the functions or procedures N/A 3 Data moves freely around the systems from one function to another Data is hidden and cannot be accessed by external functions N/A
  • 3. 4 Program structure follows “Top Down Approach” Program structure follows “Bottom UP Approach” N/A 5 Examples: C, Pascal, ALGOL and Modula-2 C++, JAVA and C# (C sharp) BASIC, COBOL, FORTRAN Key points to remember: 1. C language is structured, middle level programming language developed by Dennis Ritchie 2. Operating system programs such as Windows, Unix, Linux are written by C language 3. C89/C90 and C99 are two standardized editions of C language 4. C has been written in assembly language C – printf and scanf  printf() and scanf() functions are inbuilt library functions in C which are available in C library by default. These functions are declared and related macros are defined in “stdio.h” which is a header file.  We have to include “stdio.h” file as shown in below C program to make use of these printf() and scanf() library functions. 1. C printf() function:  printf() function is used to print the “character, string, float, integer, octal and hexadecimal values” onto the output screen.  We use printf() function with %d format specifier to display the value of an integer variable.  Similarly %c is used to display character, %f for float variable, %s for string variable, %lf for double and %x for hexadecimal variable.  To generate a newline,we use “n” in C printf() statement.
  • 4. Note:  C language is case sensitive. For example, printf() and scanf() are different from Printf() and Scanf(). All characters in printf() and scanf() functions must be in lower case. #include <stdio.h> int main() { char ch = 'A'; char str[20] = "NIIT.com"; float flt = 10.234; int no = 150; double dbl = 20.123456; printf("Character is %c n", ch); printf("String is %s n" , str); printf("Float value is %f n", flt); printf("Integer value is %dn" , no); printf("Double value is %lf n", dbl); printf("Octal value is %o n", no); printf("Hexadecimal value is %x n", no); return 0; } Output: Character is A String is NIIT.COM Float value is 10.234000 Integer value is 150 Double value is 20.123456 Octal value is 226 Hexadecimal value is 96
  • 5. You can see the output with the same data which are placed within the double quotes of printf statement in the program except  %d got replaced by value of an integer variable (no),  %c got replaced by value of a character variable (ch),  %f got replaced by value of a float variable (flt),  %lf got replaced by value of a double variable (dbl),  %s got replaced by value of a string variable (str),  %o got replaced by a octal value corresponding to integer variable (no),  %x got replaced by a hexadecimal value corresponding to integer variable  n got replaced by a newline. 2. C scanf() function:  scanf() function is used to read character, string, numeric data from keyboard  Consider below example program where user enters a character. This value is assigned to the variable “ch” and then displayed.  Then, user enters a string and this value is assigned to the variable”str” and then displayed. Example program for printf() and scanf() functions in C: #include <stdio.h> int main() { char ch; char str[100]; printf("Enter any character n"); scanf("%c", &ch); printf("Entered character is %c n", ch); printf("Enter any string ( upto 100 character ) n"); scanf("%s", &str);
  • 6. printf("Entered string is %s n", str); } Output:   The format specifier %d is used in scanf () statement. So that, the value entered is received as an integer and %s for string.  Ampersand is used before variable name “ch” in scanf () statement as &ch.  It is just like in a pointer which is used to point to the variable. For more information about how pointer works C – Data Types  C data types are defined as the data storage format that a variable can store a data to perform a specific operation.  Data types are used to define a variable before to use in a program.  Size of variable, constant and array are determined by data types. C – data types: There are four data types in C language. They are, S.no Types Data Types 1 Basic data types int, char, float, double 2 Enumeration data type enum 3 Derived data type pointer, array, structure, union 4 Void data type void Enter any character a Entered character is a Enter any string ( upto 100 character ) hai Entered string is hai
  • 7. 1. Basic data types in C: 1.1. Integer data type:  Integer data type allows a variable to store numeric values.  “int” keyword is used to refer integer data type.  The storage size of int data type is 2 or 4 or 8 byte.  It varies depend upon the processor in the CPU that we use. If we are using 16 bit processor, 2 byte (16 bit) of memory will be allocated for int data type.  Like wise, 4 byte (32 bit) of memory for 32 bit processor and 8 byte (64 bit) of memory for 64 bit processor is allocated for int datatype.  int (2 byte) can store values from -32,768 to +32,767  int (4 byte) can store values from -2,147,483,648 to +2,147,483,647.  If you want to use the integer value that crosses the above limit, you can go for “long int” and “long long int” for which the limits are very high. Note:  We can’t store decimal values using int data type.  If we use int data type to store decimal values, decimal values will be truncated and we will get only whole number.  In this case, float data type can be used to store decimal values in a variable. 1.2. Character data type:  Character data type allows a variable to store only one character.  Storage size of character data type is 1. We can store only one character using character data type.  “char” keyword is used to refer character data type.  For example, ‘A’ can be stored using char datatype. You can’t store more than one character using char data type.  Please refer C – Strings topic to know how to store more than one characters in a variable. 1.3. Floating point data type: Floating point data type consists of 2 types. They are, 1. float 2. double
  • 8. 1. float:  Float data type allows a variable to store decimal values.  Storage size of float data type is 4. This also varies depend upon the processor in the CPU as “int” data type.  We can use up-to 6 digits after decimal using float data type.  For example, 10.456789 can be stored in a variable using float data type. 2. double:  Double data type is also same as float data type which allows up-to 10 digits after decimal.  The range for double datatype is from 1E–37 to 1E+37. 1.3.1. sizeof () function in C: sizeof () function is used to find the memory space allocated for each C data types. #include <stdio.h> #include <limits.h> int main() { int a; char b; float c; double d; printf("Storage size for int data type:%d n",sizeof(a)); printf("Storage size for char data type:%d n",sizeof(b)); printf("Storage size for float data type:%d n",sizeof(c));
  • 9. printf("Storage size for double data type:%dn",sizeof(d)); return 0; } Output: Storage size for int data type:4 Storage size for char data type:1 Storage size for float data type:4 Storage size for double data type:8 1.3.2. Modifiers in C:  The amount of memory space to be allocated for a variable is derived by modifiers.  Modifiers are prefixed with basic data types to modify (either increase or decrease) the amount of storage space allocated to a variable.  For example, storage space for int data type is 4 byte for 32 bit processor. We can increase the range by using long int which is 8 byte. We can decrease the range by using short int which is 2 byte.  There are 5 modifiers available in C language. They are, 1. short 2. long 3. signed 4. unsigned 5. long long  Below table gives the detail about the storage size of each C basic data type in 16 bit processor. Please keep in mind that storage size and range for int and float datatype will vary depend on the CPU processor (8,16, 32 and 64 bit) S.No C Data types storage Range
  • 10. Size 1 char 1 –127 to 127 2 int 2 –32,767 to 32,767 3 float 4 1E–37 to 1E+37 with six digits of precision 4 double 8 1E–37 to 1E+37 with ten digits of precision 5 long double 10 1E–37 to 1E+37 with ten digits of precision 6 long int 4 –2,147,483,647 to 2,147,483,647 7 short int 2 –32,767 to 32,767 8 unsigned short int 2 0 to 65,535 9 signed short int 2 –32,767 to 32,767 10 long long int 8 –(2power(63) –1) to 2(power)63 –1 11 signed long int 4 –2,147,483,647 to 2,147,483,647 12 unsigned long int 4 0 to 4,294,967,295 13 unsigned long long int 8 2(power)64 –1
  • 11. Key words auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if static while