SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Powered by:- www.JavaTpoint.com
 C is mother language of all programming 
language. 
 It is a popular computer programming 
language. 
 It is procedure-oriented programming 
language. 
 It is also called mid level programming 
language.
 C programming language was developed in 
1972 by Dennis Ritchie at bell laboratories 
of AT&T(American Telephone & Telegraph), 
located in U.S.A. 
 Dennis Ritchie is known as founder of c 
language. 
 It was developed to be used in UNIX 
Operating system. 
 It inherits many features of previous 
languages such as B and BPCL.
Language year Developed By 
ALGOL 1960 International Group 
BPCL 1967 Martin Richards 
B 1970 Ken Thompson 
Traditional C 1972 Dennis Ritchie 
K & R C 1978 Kernighan & Dennis 
Ritchie 
ANSI C 1989 ANSI Committee 
ANSI/ISO C 1990 ISO Committee 
C99 1999 Standardization 
Committee
There are many features of c language are given below. 
1) Machine Independent or Portable 
2) Mid-level programming language 
3) structured programming language 
4) Rich Library 
5) Memory Management 
6) Fast Speed 
7) Pointers 
8) Recursion 
9) Extensible
#include <stdio.h> 
#include <conio.h> 
void main(){ 
printf(“JavaTpoint”); 
getch(); 
}
 #include <stdio.h> includes the standard input 
output library functions. The printf() function is 
defined in stdio.h . 
 #include <conio.h> includes the console input 
output library functions. The getch() function is 
defined in conio.h file. 
 void main() The main() function is the entry point 
of every program in c language. The void keyword 
specifies that it returns no value. 
 printf() The printf() function is used to print data on 
the console. 
 getch() The getch() function asks for a single 
character. Until you press any key, it blocks the 
screen.
There are two input output function of c 
language. 
1) First is printf() 
2) Second is scanf() 
 printf() function is used for output. It prints 
the given statement to the console. 
 Syntax of printf() is given below: 
 printf(“format string”,arguments_list); 
 Format string can be %d(integer), 
%c(character), %s(string), %f(float) etc.
 scanf() Function: is used for input. It reads 
the input data from console. 
 scanf(“format string”,argument_list); 
 Note:-See more example of input-output 
function on:- 
www.javatpoint.com/printf-scanf
 There are four types of data types in C 
language. 
Types Data Types 
Basic Data Type int, char, float, double 
Derived Data Type array, pointer, structure, union 
Enumeration Data Type enum 
Void Data Type void
 A keyword is a reserved word. You cannot 
use it as a variable name, constant name 
etc. 
 There are 32 keywords in C language as given 
below: 
auto break case char const contin 
ue 
default do 
double else enum extern float for goto if 
int long register return short signed sizeof static 
struct switch typedef union unsigned void volatile while
 There are following types of operators to 
perform different types of operations in C 
language. 
1) Arithmetic Operators 
2) Relational Operators 
3) Shift Operators 
4) Logical Operators 
5) Bitwise Operators 
6) Ternary or Conditional Operators 
7) Assignment Operator 
8) Misc Operator
1) if-else 
2) switch 
3) loops 
4) do-while loop 
5) while loop 
6) for loop 
7) break 
8) continue
 There are many ways to use if statement in C 
language: 
1) If statement 
2) If-else statement 
3) If else-if ladder 
4) Nested if
 In if statement is used to execute the code if 
condition is true. 
 syntax:- 
if(expression){ 
//code to be execute 
}
 The if-else statement is used to execute the 
code if condition is true or false. 
 Syntax: 
if(expression){ 
//code to be executed if condition is true 
}else{ 
//code to be executed if condition is false 
}
Syntax: 
if(condition1){ 
//code to be executed if condition1 is true 
}else if(condition2){ 
//code to be executed if condition2 is true 
} 
else if(condition3){ 
//code to be executed if condition3 is true 
} 
... 
else{ 
//code to be executed if all the conditions are false 
}
 Syntax: 
switch(expression){ 
case value1: 
//code to be executed; 
break; //optional 
case value2: 
//code to be executed; 
break; //optional 
...... 
default: 
code to be executed if all cases are not matched; 
}
 Loops are used to execute a block of code or 
a part of program of the program several 
times. 
Types of loops in C language:- 
 There are 3 types of loops in c language. 
1) do while 
2) while 
3) for
 It is better if you have to execute the code 
at least once. 
 Syntax:- 
do{ 
//code to be executed 
}while(condition);
 It is better if number of iteration is not 
known by the user. 
 Syntax:- 
while(condition){ 
//code to be executed 
}
 It is good if number of iteration is known by 
the user. 
 Syntax:- 
for(initialization;condition;incr/decr){ 
//code to be executed 
}
 it is used to break the execution of loop 
(while, do while and for) and switch case. 
 Syntax:- 
jump-statement; 
break;
 it is used to continue the execution of loop 
(while, do while and for). It is used with if 
condition within the loop. 
 Syntax:- 
jump-statement; 
continue; 
Note:- you can see the example of above all 
control statements on. 
www.javatpoint.com/c-if else
 To perform any task, we can create function. 
A function can be called many times. It 
provides modularity and code reusability. 
Advantage of function:- 
1) Code Resuability 
2) Code optimization
return_type function_name(data_type paramet 
er...){ 
//code to be executed 
} 
 Syntax to call function:- 
variable=function_name(arguments...);
 In call by value, value being passed to the 
function is locally stored by the function 
parameter in stack memory location. 
 If you change the value of function 
parameter, it is changed for the current 
function only. 
 It will not change the value of variable 
inside the caller method such as main().
#include <stdio.h> 
#include <conio.h> 
void change(int num) { 
printf("Before adding value inside function num=%d n",num); 
num=num+100; 
printf("After adding value inside function num=%d n", num); 
} 
int main() { 
int x=100; 
clrscr(); 
printf("Before function call x=%d n", x); 
change(x);//passing value in function 
printf("After function call x=%d n", x); 
getch(); 
return 0; 
}
Before function call x=100 
Before adding value inside function num=100 
After adding value inside function num=200 
After function call x=100
 In call by reference, original value is 
modified because we pass reference 
(address). 
 Note : Learn Call by reference in details with 
example via JavaTpoint.
#include <stdio.h> 
#include <conio.h> 
void change(int *num) { 
printf("Before adding value inside function num=%d n",*num); 
(*num) += 100; 
printf("After adding value inside function num=%d n", *num); 
} 
int main() { 
int x=100; 
clrscr(); 
printf("Before function call x=%d n", x); 
change(&x);//passing reference in function 
printf("After function call x=%d n", x); 
getch(); 
return 0; 
}
Before function call x=100 
Before adding value inside function num=100 
After adding value inside function num=200 
After function call x=200
 A function that calls itself, and doen't 
perform any task after function call, is know 
as tail recursion. In tail recursion, we 
generally call the same function with return 
statement. 
 Syntax:- 
recursionfunction(){ 
recursionfunction();//calling self function 
}
 Array in C language is a collection or group of 
elements (data). All the elements of array 
are homogeneous(similar). It has contiguous 
memory location. 
Declaration of array:- 
 data_type array_name[array_size]; 
Eg:- 
 int marks[7]; 
Types of array:- 
1) 1-D Array 
2) 2-D Array
1) Code Optimization 
2) Easy to traverse data 
3) Easy to sort data 
4) Random Access
 2-d Array is represented in the form of rows 
and columns, also known as matrix. It is also 
known as array of arrays or list of arrays. 
Declaration of 2-d array:- 
 data_type array_name[size1][size2];
int arr[3][4]={{1,2,3,4},{2,3,4,5},{3,4,5,6}}; 
C1 C2 C3 C4 
R1 
R2 
R3 
1 2 3 4 
2 3 4 5 
3 4 5 6
 Pointer is a user defined data_type which 
create the special types of variables. 
 It can hold the address of primitive data type 
like int, char, float, double or user define 
datatypes like function, pointer etc. 
 it is used to retrieving strings, trees etc. and 
used with arrays, structures and functions.
 Pointer reduces the code and improves the 
performance. 
We can return multiple values from function 
using pointer. 
 It make you able to access any memory 
location in the computer’s memory.
Symbol Name Description 
& (ampersand 
sign) 
address of operator determines the 
address of a 
variable. 
* (asterisk sign) indirection operator accesses the value 
at the address.
Syntax:- 
int *ptr; 
int (*ptr)(); 
int (*ptr)[2]; 
For e.g.- 
int a=5; // a= variable name// 
int * ptr; // value of variable= 5// 
ptr=&a; // Address where it has stored in 
memory : 1025 (assume) //
#include <stdio.h> 
#include <conio.h> 
void main(){ 
int number=50; 
clrscr(); 
printf("value of number is %d, address 
of number is %u",number,&number); 
getch(); 
}
Referenced by:-
C programming language tutorial

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and String
 
Storage class in C Language
Storage class in C LanguageStorage class in C Language
Storage class in C Language
 
Standard Library Functions
Standard Library FunctionsStandard Library Functions
Standard Library Functions
 
File handling in c
File handling in cFile handling in c
File handling in c
 
Control structures in c
Control structures in cControl structures in c
Control structures in c
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 
data types in C programming
data types in C programmingdata types in C programming
data types in C programming
 
C functions
C functionsC functions
C functions
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
file handling c++
file handling c++file handling c++
file handling c++
 
String functions in C
String functions in CString functions in C
String functions in C
 
Strings in python
Strings in pythonStrings in python
Strings in python
 
C tokens
C tokensC tokens
C tokens
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
How to execute a C program
How to execute a C  program How to execute a C  program
How to execute a C program
 
Python programming : Files
Python programming : FilesPython programming : Files
Python programming : Files
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
Function in C program
Function in C programFunction in C program
Function in C program
 

Andere mochten auch

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 - JavaTpointJavaTpoint.Com
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGAbhishek Dwivedi
 
Introduction to Programming Language using C
Introduction to Programming Language using CIntroduction to Programming Language using C
Introduction to Programming Language using CTrinity Dwarka
 
Connect all your customers on one multichannel platform!
Connect all your customers on one multichannel platform!Connect all your customers on one multichannel platform!
Connect all your customers on one multichannel platform!Slawomir Kluczewski
 
Tutorial on c language programming
Tutorial on c language programmingTutorial on c language programming
Tutorial on c language programmingSudheer Kiran
 
20 C programs
20 C programs20 C programs
20 C programsnavjoth
 
Python in raspberry pi
Python in raspberry piPython in raspberry pi
Python in raspberry piSudar Muthu
 
Conditional Loops Python
Conditional Loops PythonConditional Loops Python
Conditional Loops Pythonprimeteacher32
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programminggajendra singh
 
Socket Programming In Python
Socket Programming In PythonSocket Programming In Python
Socket Programming In Pythondidip
 
Cloud Computing to Internet of Things
Cloud Computing to Internet of ThingsCloud Computing to Internet of Things
Cloud Computing to Internet of ThingsHermesDDS
 
Got Python I/O: IoT Develoment in Python via GPIO
Got Python I/O: IoT Develoment in Python via GPIOGot Python I/O: IoT Develoment in Python via GPIO
Got Python I/O: IoT Develoment in Python via GPIOAdam Englander
 
Internet of Things for Libraries
Internet of Things for LibrariesInternet of Things for Libraries
Internet of Things for LibrariesNicole Baratta
 
C programs
C programsC programs
C programsMinu S
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in CSmit Parikh
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsRuth Marvin
 

Andere mochten auch (20)

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
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
C language ppt
C language pptC language ppt
C language ppt
 
Introduction to Programming Language using C
Introduction to Programming Language using CIntroduction to Programming Language using C
Introduction to Programming Language using C
 
Connect all your customers on one multichannel platform!
Connect all your customers on one multichannel platform!Connect all your customers on one multichannel platform!
Connect all your customers on one multichannel platform!
 
Tutorial on c language programming
Tutorial on c language programmingTutorial on c language programming
Tutorial on c language programming
 
20 C programs
20 C programs20 C programs
20 C programs
 
Computer Logic
Computer LogicComputer Logic
Computer Logic
 
Python in raspberry pi
Python in raspberry piPython in raspberry pi
Python in raspberry pi
 
Conditional Loops Python
Conditional Loops PythonConditional Loops Python
Conditional Loops Python
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Loops in c
Loops in cLoops in c
Loops in c
 
Socket Programming In Python
Socket Programming In PythonSocket Programming In Python
Socket Programming In Python
 
Cloud Computing to Internet of Things
Cloud Computing to Internet of ThingsCloud Computing to Internet of Things
Cloud Computing to Internet of Things
 
Got Python I/O: IoT Develoment in Python via GPIO
Got Python I/O: IoT Develoment in Python via GPIOGot Python I/O: IoT Develoment in Python via GPIO
Got Python I/O: IoT Develoment in Python via GPIO
 
CS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUALCS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUAL
 
Internet of Things for Libraries
Internet of Things for LibrariesInternet of Things for Libraries
Internet of Things for Libraries
 
C programs
C programsC programs
C programs
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in C
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 

Ähnlich wie C programming language tutorial

Introduction to c
Introduction to cIntroduction to c
Introduction to camol_chavan
 
Complete c programming presentation
Complete c programming presentationComplete c programming presentation
Complete c programming presentationnadim akber
 
C programming session 01
C programming session 01C programming session 01
C programming session 01Dushmanta Nath
 
C programming day#2.
C programming day#2.C programming day#2.
C programming day#2.Mohamed Fawzy
 
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.pptxAnkitaVerma776806
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++Haripritha
 
C programming(part 3)
C programming(part 3)C programming(part 3)
C programming(part 3)SURBHI SAROHA
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingRasan Samarasinghe
 
C standard library functions
C standard library functionsC standard library functions
C standard library functionsVaishnavee Sharma
 
Fundamentals of Programming Constructs.pptx
Fundamentals of  Programming Constructs.pptxFundamentals of  Programming Constructs.pptx
Fundamentals of Programming Constructs.pptxvijayapraba1
 
Introduction to C Unit 1
Introduction to C Unit 1Introduction to C Unit 1
Introduction to C Unit 1SURBHI SAROHA
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentalsHCMUTE
 

Ähnlich wie C programming language tutorial (20)

Introduction to c
Introduction to cIntroduction to c
Introduction to c
 
Complete c programming presentation
Complete c programming presentationComplete c programming presentation
Complete c programming presentation
 
C programming session 01
C programming session 01C programming session 01
C programming session 01
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
C programming day#2.
C programming day#2.C programming day#2.
C programming day#2.
 
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
 
C notes for exam preparation
C notes for exam preparationC notes for exam preparation
C notes for exam preparation
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
 
C programming(part 3)
C programming(part 3)C programming(part 3)
C programming(part 3)
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
Quiz 9
Quiz 9Quiz 9
Quiz 9
 
Managing I/O in c++
Managing I/O in c++Managing I/O in c++
Managing I/O in c++
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
C standard library functions
C standard library functionsC standard library functions
C standard library functions
 
Embedded C - Lecture 2
Embedded C - Lecture 2Embedded C - Lecture 2
Embedded C - Lecture 2
 
Fundamentals of Programming Constructs.pptx
Fundamentals of  Programming Constructs.pptxFundamentals of  Programming Constructs.pptx
Fundamentals of Programming Constructs.pptx
 
Introduction to C Unit 1
Introduction to C Unit 1Introduction to C Unit 1
Introduction to C Unit 1
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
Theory1&amp;2
Theory1&amp;2Theory1&amp;2
Theory1&amp;2
 

Kürzlich hochgeladen

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 

Kürzlich hochgeladen (20)

Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 

C programming language tutorial

  • 2.
  • 3.  C is mother language of all programming language.  It is a popular computer programming language.  It is procedure-oriented programming language.  It is also called mid level programming language.
  • 4.  C programming language was developed in 1972 by Dennis Ritchie at bell laboratories of AT&T(American Telephone & Telegraph), located in U.S.A.  Dennis Ritchie is known as founder of c language.  It was developed to be used in UNIX Operating system.  It inherits many features of previous languages such as B and BPCL.
  • 5. Language year Developed By ALGOL 1960 International Group BPCL 1967 Martin Richards B 1970 Ken Thompson Traditional C 1972 Dennis Ritchie K & R C 1978 Kernighan & Dennis Ritchie ANSI C 1989 ANSI Committee ANSI/ISO C 1990 ISO Committee C99 1999 Standardization Committee
  • 6. There are many features of c language are given below. 1) Machine Independent or Portable 2) Mid-level programming language 3) structured programming language 4) Rich Library 5) Memory Management 6) Fast Speed 7) Pointers 8) Recursion 9) Extensible
  • 7. #include <stdio.h> #include <conio.h> void main(){ printf(“JavaTpoint”); getch(); }
  • 8.  #include <stdio.h> includes the standard input output library functions. The printf() function is defined in stdio.h .  #include <conio.h> includes the console input output library functions. The getch() function is defined in conio.h file.  void main() The main() function is the entry point of every program in c language. The void keyword specifies that it returns no value.  printf() The printf() function is used to print data on the console.  getch() The getch() function asks for a single character. Until you press any key, it blocks the screen.
  • 9.
  • 10. There are two input output function of c language. 1) First is printf() 2) Second is scanf()  printf() function is used for output. It prints the given statement to the console.  Syntax of printf() is given below:  printf(“format string”,arguments_list);  Format string can be %d(integer), %c(character), %s(string), %f(float) etc.
  • 11.  scanf() Function: is used for input. It reads the input data from console.  scanf(“format string”,argument_list);  Note:-See more example of input-output function on:- www.javatpoint.com/printf-scanf
  • 12.  There are four types of data types in C language. Types Data Types Basic Data Type int, char, float, double Derived Data Type array, pointer, structure, union Enumeration Data Type enum Void Data Type void
  • 13.  A keyword is a reserved word. You cannot use it as a variable name, constant name etc.  There are 32 keywords in C language as given below: auto break case char const contin ue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while
  • 14.  There are following types of operators to perform different types of operations in C language. 1) Arithmetic Operators 2) Relational Operators 3) Shift Operators 4) Logical Operators 5) Bitwise Operators 6) Ternary or Conditional Operators 7) Assignment Operator 8) Misc Operator
  • 15. 1) if-else 2) switch 3) loops 4) do-while loop 5) while loop 6) for loop 7) break 8) continue
  • 16.  There are many ways to use if statement in C language: 1) If statement 2) If-else statement 3) If else-if ladder 4) Nested if
  • 17.  In if statement is used to execute the code if condition is true.  syntax:- if(expression){ //code to be execute }
  • 18.  The if-else statement is used to execute the code if condition is true or false.  Syntax: if(expression){ //code to be executed if condition is true }else{ //code to be executed if condition is false }
  • 19. Syntax: if(condition1){ //code to be executed if condition1 is true }else if(condition2){ //code to be executed if condition2 is true } else if(condition3){ //code to be executed if condition3 is true } ... else{ //code to be executed if all the conditions are false }
  • 20.  Syntax: switch(expression){ case value1: //code to be executed; break; //optional case value2: //code to be executed; break; //optional ...... default: code to be executed if all cases are not matched; }
  • 21.  Loops are used to execute a block of code or a part of program of the program several times. Types of loops in C language:-  There are 3 types of loops in c language. 1) do while 2) while 3) for
  • 22.  It is better if you have to execute the code at least once.  Syntax:- do{ //code to be executed }while(condition);
  • 23.  It is better if number of iteration is not known by the user.  Syntax:- while(condition){ //code to be executed }
  • 24.  It is good if number of iteration is known by the user.  Syntax:- for(initialization;condition;incr/decr){ //code to be executed }
  • 25.  it is used to break the execution of loop (while, do while and for) and switch case.  Syntax:- jump-statement; break;
  • 26.  it is used to continue the execution of loop (while, do while and for). It is used with if condition within the loop.  Syntax:- jump-statement; continue; Note:- you can see the example of above all control statements on. www.javatpoint.com/c-if else
  • 27.  To perform any task, we can create function. A function can be called many times. It provides modularity and code reusability. Advantage of function:- 1) Code Resuability 2) Code optimization
  • 28. return_type function_name(data_type paramet er...){ //code to be executed }  Syntax to call function:- variable=function_name(arguments...);
  • 29.  In call by value, value being passed to the function is locally stored by the function parameter in stack memory location.  If you change the value of function parameter, it is changed for the current function only.  It will not change the value of variable inside the caller method such as main().
  • 30. #include <stdio.h> #include <conio.h> void change(int num) { printf("Before adding value inside function num=%d n",num); num=num+100; printf("After adding value inside function num=%d n", num); } int main() { int x=100; clrscr(); printf("Before function call x=%d n", x); change(x);//passing value in function printf("After function call x=%d n", x); getch(); return 0; }
  • 31. Before function call x=100 Before adding value inside function num=100 After adding value inside function num=200 After function call x=100
  • 32.  In call by reference, original value is modified because we pass reference (address).  Note : Learn Call by reference in details with example via JavaTpoint.
  • 33. #include <stdio.h> #include <conio.h> void change(int *num) { printf("Before adding value inside function num=%d n",*num); (*num) += 100; printf("After adding value inside function num=%d n", *num); } int main() { int x=100; clrscr(); printf("Before function call x=%d n", x); change(&x);//passing reference in function printf("After function call x=%d n", x); getch(); return 0; }
  • 34. Before function call x=100 Before adding value inside function num=100 After adding value inside function num=200 After function call x=200
  • 35.  A function that calls itself, and doen't perform any task after function call, is know as tail recursion. In tail recursion, we generally call the same function with return statement.  Syntax:- recursionfunction(){ recursionfunction();//calling self function }
  • 36.  Array in C language is a collection or group of elements (data). All the elements of array are homogeneous(similar). It has contiguous memory location. Declaration of array:-  data_type array_name[array_size]; Eg:-  int marks[7]; Types of array:- 1) 1-D Array 2) 2-D Array
  • 37. 1) Code Optimization 2) Easy to traverse data 3) Easy to sort data 4) Random Access
  • 38.  2-d Array is represented in the form of rows and columns, also known as matrix. It is also known as array of arrays or list of arrays. Declaration of 2-d array:-  data_type array_name[size1][size2];
  • 39. int arr[3][4]={{1,2,3,4},{2,3,4,5},{3,4,5,6}}; C1 C2 C3 C4 R1 R2 R3 1 2 3 4 2 3 4 5 3 4 5 6
  • 40.  Pointer is a user defined data_type which create the special types of variables.  It can hold the address of primitive data type like int, char, float, double or user define datatypes like function, pointer etc.  it is used to retrieving strings, trees etc. and used with arrays, structures and functions.
  • 41.  Pointer reduces the code and improves the performance. We can return multiple values from function using pointer.  It make you able to access any memory location in the computer’s memory.
  • 42. Symbol Name Description & (ampersand sign) address of operator determines the address of a variable. * (asterisk sign) indirection operator accesses the value at the address.
  • 43. Syntax:- int *ptr; int (*ptr)(); int (*ptr)[2]; For e.g.- int a=5; // a= variable name// int * ptr; // value of variable= 5// ptr=&a; // Address where it has stored in memory : 1025 (assume) //
  • 44. #include <stdio.h> #include <conio.h> void main(){ int number=50; clrscr(); printf("value of number is %d, address of number is %u",number,&number); getch(); }
  • 45.