SlideShare a Scribd company logo
C language presentation
table of content
•Introduction
•Historical development of c
•C tokens
•Identifiers
•Keyword
•Data type
•Constants and variable
•Variable
•C instruction
•Type of operation.
•if else statement
•switch statement
•looping
•array
•storage classes
•type of function call in c
•function
•pointer
•structure
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
C language presentation
Declaring an Array
Like any other variable, arrays must be declared before they are used.
General form of array declaration is,
data-type variable-name[size];
for example :int arr[10];
Here int is the data type, arr is the name of the array and 10 is the size of array. It means
array arr can only contain 10 elements of int type. Index of an array starts from 0 to size-1
i.e first element of arr array will be stored at arr[0] address and last element will occupy
arr[9].
Two dimensional Arrays
C language supports multidimensional arrays. The simplest form of the
multidimensional array is the two-dimensional array.
Two-dimensional array is declared as follows,
type array-name[row-size][column-size] Example : int a[3][4];
The above array can also be declared and initialized together. Such as,
Storage classes
In C language, each variable has a storage class which decides
scope, visibility and lifetime of that variable. The following
storage classes are most oftenly used in C programming,
Automatic variables
A variable declared inside a function without any storage class specification,
is by default an automatic variable. They are created when a function is
called and are destroyed automatically when the function exits. Automatic
variables can also be called local variables because they are local to a
function. By default they are assigned garbage value by the compiled
External or Global variable
A variable that is declared outside any function is a Global variable. Global variables remain
available throughout the entire program. One important thing to remember about global
variable is that their values can be changed by any function in the program.
int number;
void main()
{
number=10;
}
fun1()
{
number=20;
}
fun2()
{number=30;
}Here the global variable number is available to all three functions.
Static variables
A static variable tells the compiler to persist the variable until the end of program.
Instead of creating and destroying a variable every time when it comes into and goes
out of scope, static is initialized only once and remains into existence till the end of
program. A static variable can either be internal or external depending upon the place of
declaraction. Scope of internal static variable remains inside the function in which it is
defined.
External static
variables remain restricted to scope of file in each they are declared.
They are assigned 0 (zero) as default value by the compiler.
void test(); //Function declaration (discussed in next topic)
main()
{
test();
test();
test();
}
void test()
{
static int a = 0; //Static variable
a = a+1;
printf("%dt",a);
}
output :1 2 3
Register variable
Register variable inform the compiler to store the variable in
register instead of memory. Register variable has faster access
than normal variable. Frequently used variables are kept in register.
Only few variables can be placed inside register..
Syntax :
register int number;
Types of Function calls in C
Functions are called by their names. If the function is without argument, it can be called directly
using its name. But for functions with arguments, we have two ways to call them,
1.Call by Value
2.Call by Reference
Call by Value
In this calling technique we pass the values of arguments which are stored or copied into the formal parameters
of functions. Hence, the original values are unchanged only the parameters inside function changes.
In this case the actual variable x is not changed, because we pass argument by value, hence a
copy of x is passed, which is changed, and that copied value is destroyed as the function
ends(goes out of scope). So the variable x inside main() still has a value 10.
Call by Reference
In this we pass the address of the variable as arguments. In this
case the formal parameter can be taken as a reference or a
pointer, in both the case they will change the values of the
original variable.
void calc
(int *p);
int main()
{
int x = 10;
calc(&x); // passing address of x as argument
printf("%d", x);
}
void calc(int *p)
{
*p = *p + 10;
}
Output : 20
C language presentation
C language presentation
C language presentation

More Related Content

What's hot (20)

PPTX
Amit user defined functions xi (2)
Arpit Meena
 
PPT
User Defined Functions
Praveen M Jigajinni
 
PPTX
Method parameters in c#
Dr.Neeraj Kumar Pandey
 
DOC
Storage classess of C progamming
Appili Vamsi Krishna
 
PPTX
Functions in C
Shobhit Upadhyay
 
PPTX
Functions in c language
tanmaymodi4
 
PPTX
Function & Recursion
Meghaj Mallick
 
PPTX
parameter passing in c#
khush_boo31
 
PPTX
Function in c
Raj Tandukar
 
PPT
user defined function
King Kavin Patel
 
PPTX
Types of function call
ArijitDhali
 
PPTX
Storage Classes and Functions
Jake Bond
 
PPTX
Storage classes in C
Self employed
 
PPT
Function in C Language
programmings guru
 
PPTX
Functions in C
Kamal Acharya
 
PPTX
predefined and user defined functions
Swapnil Yadav
 
PPT
Pre defined Functions in C
Prabhu Govind
 
PPTX
Storage classes in C
Nitesh Bichwani
 
PPT
User Defined Functions in C
RAJ KUMAR
 
Amit user defined functions xi (2)
Arpit Meena
 
User Defined Functions
Praveen M Jigajinni
 
Method parameters in c#
Dr.Neeraj Kumar Pandey
 
Storage classess of C progamming
Appili Vamsi Krishna
 
Functions in C
Shobhit Upadhyay
 
Functions in c language
tanmaymodi4
 
Function & Recursion
Meghaj Mallick
 
parameter passing in c#
khush_boo31
 
Function in c
Raj Tandukar
 
user defined function
King Kavin Patel
 
Types of function call
ArijitDhali
 
Storage Classes and Functions
Jake Bond
 
Storage classes in C
Self employed
 
Function in C Language
programmings guru
 
Functions in C
Kamal Acharya
 
predefined and user defined functions
Swapnil Yadav
 
Pre defined Functions in C
Prabhu Govind
 
Storage classes in C
Nitesh Bichwani
 
User Defined Functions in C
RAJ KUMAR
 

Viewers also liked (6)

PDF
Commercial Building Services_MB-100 Rev D
Graeme Simmers
 
PDF
new profile_52.3m_three points_unsplitted-Nonlinear with epoxy-1
Vishnu R
 
PPTX
Waterproof &Airproof Garments
Jotish Roy (BUBT)
 
PPTX
Maboneng Pricint
Nano Shadung
 
PDF
NON LINEAR ANALYSIS OF A HAWT BLADE USING LARGE DEFLECTION CRITERIA
Vishnu R
 
DOCX
CV DAVID EDWARD FISHER
David Fisher
 
Commercial Building Services_MB-100 Rev D
Graeme Simmers
 
new profile_52.3m_three points_unsplitted-Nonlinear with epoxy-1
Vishnu R
 
Waterproof &Airproof Garments
Jotish Roy (BUBT)
 
Maboneng Pricint
Nano Shadung
 
NON LINEAR ANALYSIS OF A HAWT BLADE USING LARGE DEFLECTION CRITERIA
Vishnu R
 
CV DAVID EDWARD FISHER
David Fisher
 
Ad

Similar to C language presentation (20)

PDF
Storage Classes.pdf DJJKLF DKFF DSLKF. DSF; FD
AbcdR5
 
PPTX
STORAGE CLASS.pptx
BU210535JeevanKishor
 
PPTX
cs3362 c programming and data structures
UdhayaSankar13
 
PPTX
C Programming and Data structure C Programming and Data structures
UdhayaSankar13
 
PPTX
Fundamentals of Programming Constructs.pptx
vijayapraba1
 
PPTX
Storage class in c
kash95
 
PPT
cs8251 unit 1 ppt
praveenaprakasam
 
PDF
C pointers and references
Thesis Scientist Private Limited
 
PPTX
C PROGRAMING.pptx
MohammedtajuddinTaju
 
PPTX
Unit-4 (Scope Rules and Arrays).pptx for
pattinsonhenry524
 
PPTX
Pointers
Munazza-Mah-Jabeen
 
PDF
Functions, Strings ,Storage classes in C
arshpreetkaur07
 
PDF
Terms and Definitions.pdf
SheikhAbrarAhmad
 
PPTX
Storage classes
Puneet Rajput
 
PPTX
Global variables, sorting static variables,function and arrays,
Ahmad55ali
 
PPT
Session 5
Shailendra Mathur
 
PPT
S torage class in C
kash95
 
Storage Classes.pdf DJJKLF DKFF DSLKF. DSF; FD
AbcdR5
 
STORAGE CLASS.pptx
BU210535JeevanKishor
 
cs3362 c programming and data structures
UdhayaSankar13
 
C Programming and Data structure C Programming and Data structures
UdhayaSankar13
 
Fundamentals of Programming Constructs.pptx
vijayapraba1
 
Storage class in c
kash95
 
cs8251 unit 1 ppt
praveenaprakasam
 
C pointers and references
Thesis Scientist Private Limited
 
C PROGRAMING.pptx
MohammedtajuddinTaju
 
Unit-4 (Scope Rules and Arrays).pptx for
pattinsonhenry524
 
Functions, Strings ,Storage classes in C
arshpreetkaur07
 
Terms and Definitions.pdf
SheikhAbrarAhmad
 
Storage classes
Puneet Rajput
 
Global variables, sorting static variables,function and arrays,
Ahmad55ali
 
S torage class in C
kash95
 
Ad

Recently uploaded (20)

PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
Horarios de distribución de agua en julio
pegazohn1978
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Dimensions of Societal Planning in Commonism
StefanMz
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 

C language presentation

  • 2. table of content •Introduction •Historical development of c •C tokens •Identifiers •Keyword •Data type •Constants and variable •Variable •C instruction •Type of operation. •if else statement •switch statement •looping •array •storage classes •type of function call in c •function •pointer •structure
  • 36. Declaring an Array Like any other variable, arrays must be declared before they are used. General form of array declaration is, data-type variable-name[size]; for example :int arr[10]; Here int is the data type, arr is the name of the array and 10 is the size of array. It means array arr can only contain 10 elements of int type. Index of an array starts from 0 to size-1 i.e first element of arr array will be stored at arr[0] address and last element will occupy arr[9].
  • 37. Two dimensional Arrays C language supports multidimensional arrays. The simplest form of the multidimensional array is the two-dimensional array. Two-dimensional array is declared as follows, type array-name[row-size][column-size] Example : int a[3][4]; The above array can also be declared and initialized together. Such as,
  • 38. Storage classes In C language, each variable has a storage class which decides scope, visibility and lifetime of that variable. The following storage classes are most oftenly used in C programming, Automatic variables A variable declared inside a function without any storage class specification, is by default an automatic variable. They are created when a function is called and are destroyed automatically when the function exits. Automatic variables can also be called local variables because they are local to a function. By default they are assigned garbage value by the compiled External or Global variable A variable that is declared outside any function is a Global variable. Global variables remain available throughout the entire program. One important thing to remember about global variable is that their values can be changed by any function in the program. int number; void main() { number=10; } fun1() { number=20; } fun2() {number=30; }Here the global variable number is available to all three functions.
  • 39. Static variables A static variable tells the compiler to persist the variable until the end of program. Instead of creating and destroying a variable every time when it comes into and goes out of scope, static is initialized only once and remains into existence till the end of program. A static variable can either be internal or external depending upon the place of declaraction. Scope of internal static variable remains inside the function in which it is defined. External static variables remain restricted to scope of file in each they are declared. They are assigned 0 (zero) as default value by the compiler. void test(); //Function declaration (discussed in next topic) main() { test(); test(); test(); } void test() { static int a = 0; //Static variable a = a+1; printf("%dt",a); } output :1 2 3
  • 40. Register variable Register variable inform the compiler to store the variable in register instead of memory. Register variable has faster access than normal variable. Frequently used variables are kept in register. Only few variables can be placed inside register.. Syntax : register int number; Types of Function calls in C Functions are called by their names. If the function is without argument, it can be called directly using its name. But for functions with arguments, we have two ways to call them, 1.Call by Value 2.Call by Reference Call by Value In this calling technique we pass the values of arguments which are stored or copied into the formal parameters of functions. Hence, the original values are unchanged only the parameters inside function changes. In this case the actual variable x is not changed, because we pass argument by value, hence a copy of x is passed, which is changed, and that copied value is destroyed as the function ends(goes out of scope). So the variable x inside main() still has a value 10.
  • 41. Call by Reference In this we pass the address of the variable as arguments. In this case the formal parameter can be taken as a reference or a pointer, in both the case they will change the values of the original variable. void calc (int *p); int main() { int x = 10; calc(&x); // passing address of x as argument printf("%d", x); } void calc(int *p) { *p = *p + 10; } Output : 20