Govt. Polytechnic,Dhangar

Slides:



Advertisements
Similar presentations
Variables in C Amir Haider Lecturer.
Advertisements

Introduction to C Programming
C Language.
Chapter 3: Beginning Problem Solving Concepts for the Computer Programming Computer Programming Skills /1436 Department of Computer Science.
Structure of a C program
C programming Language and Data Structure For DIT Students.
C Programming Language tutorial Powered by:-
Lecture No: 16. The scanf() function In C programming language, the scanf() function is used to read information from standard input device (keyboard).
Introduction to Computer Algorithmics and Programming Ceng 113 Variables and Operators in C.
By Sidhant Garg.  C was developed between by Dennis Ritchie at Bell Laboratories for use with the Unix Operating System.  Unlike previously.
C Tokens Identifiers Keywords Constants Operators Special symbols.
C-Language Keywords(C99)
C STRUCTURES. A FIRST C PROGRAM  #include  void main ( void )  { float height, width, area, wood_length ;  scanf ( "%f", &height ) ;  scanf ( "%f",
C Programming language Basic Concepts Prepared By The Smartpath Information systems
Dennis Ritchie 1972 AT & T Bell laboratories (American Telephone and Telegraph) USA 1www.gowreeswar.com.
Data Structure and c K.S.Prabhu Lecturer All Deaf Educational Technology.
Slides created by: Professor Ian G. Harris Hello World #include main() { printf(“Hello, world.\n”); }  #include is a compiler directive to include (concatenate)
Lecture 15: Course Review BJ Furman ME 30 16MAY2011.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
BASIC C PROGRAMMING LANGUAGE TUTORIAL infobizzs.com.
INTRODUCTION TO PROGRAMING System Development Mansoura October 2015.
Introduction to C Programming I Subject: T0016 – ALGORITHM AND PROGRAMMING Year: 2013.
C++ Lesson 1.
‘C’ Programming Structures and Commands
UNIT 5 C Pointers.
C Interview Questions Prepared By:.
Data types Data types Basic types
A bit of C programming Lecture 3 Uli Raich.
INC 161 , CPE 100 Computer Programming
Decisions Chapter 4.
LESSON 3 IO, Variables and Operators
C Language VIVA Questions with Answers
History of ‘C’ Root of the morden language is ALGOL It’s first
Learning C Language.
Overview of C.
C Fundamentals & Pointers
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
C Short Overview Lembit Jürimägi.
Prepared By: G.UshaRani B.Pranalini A.S.Lalitha
Introduction to C Programming Language
' C ' PROGRAMMING SRM-MCA.
Visit for more Learning Resources
11/10/2018.
CMSC 104, Section 4 Richard Chang
Advanced Programming Basics
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Character Set Uppercase Alphabets A,
פרטים נוספים בסילבוס של הקורס
Variables in C Topics Naming Variables Declaring Variables
Basics of ‘C’.
Introduction to C Programming
Govt. Polytechnic,Dhangar
Variables, Identifiers, Assignments, Input/Output
Introduction C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell.
C programming Language
2. Second Step for Learning C++ Programming • Data Type • Char • Float
Programming Language C Language.
C ( Programming Language ) PSK Technologies By: Arti Sontakke An ISO 9001:2015 (QMS) Certified IT Company Computer Education | Software Development | Computer.
The C Language: Intro.
C – Programming Language
Programming Languages and Paradigms
Variables in C Topics Naming Variables Declaring Variables
C Language B. DHIVYA 17PCA140 II MCA.
Variables in C Topics Naming Variables Declaring Variables
Course Outcomes of Programming In C (PIC) (17212, C203):
Variables in C Topics Naming Variables Declaring Variables
INTRODUCTION TO C.
Variables in C Topics Naming Variables Declaring Variables
Getting Started With Coding
Presentation transcript:

Govt. Polytechnic,Dhangar Power Point Presentation of Programming In C Submitted By:- (Ms. Khushboo) .

What is c language:- 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.

History of c 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.

History of c programming 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

Features of C Language:- There are many features of c language are given below. Machine Independent or Portable Mid-level programming language structured programming language Rich Library Memory Management Fast Speed Pointers Recursion Extensible

First Program of C Language:- #include <stdio.h>   #include <conio.h>   void main(){   printf(“JavaTpoint”);     getch();   }  

Describe the C Program :- #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.

Output of Program is:- JavaTpoint

Input output function:- There are two input output function of c language. First is printf() 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.

Input/ output function 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

Data types in C language:- 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

Keywords in C Language:- 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 continue 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

Operators in C language:- There are following types of operators to perform different types of operations in C language. Arithmetic Operators Relational Operators Shift Operators Logical Operators Bitwise Operators Ternary or Conditional Operators Assignment Operator Misc Operator

Control statement in C language:- if-else switch loops do-while loop while loop for loop break continue

C if else statement:- There are many ways to use if statement in C language: If statement If-else statement If else-if ladder Nested if

if statement:- In if statement is used to execute the code if condition is true. syntax:- if(expression){ //code to be execute }

If else statement:- 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   }  

if else-if ladder Statement:- 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  

C Switch Statement:- Syntax: switch(expression){ case value1:  //code to be executed;      break;  //optional   case value2:     ......     default:       code to be executed if all cases are not matched;      }    

Loops in C language:- 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. do while while for

do-while loop in C:- It is better if you have to execute the code at least once. Syntax:- do{   //code to be executed   }while(condition); 

while loop in c language:- It is better if number of iteration is not known by the user. Syntax:- while(condition){   //code to be executed   } 

For loop in C language:- It is good if number of iteration is known by the user. Syntax:- for(initialization;condition;incr/decr){   //code to be executed   } 

C break statement:-  it is used to break the execution of loop (while, do while and for) and switch case. Syntax:- jump-statement;   break;  

Continue statement in C language:- 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

Functions in C language:- To perform any task, we can create function. A function can be called many times. It provides modularity and code reusability. Advantage of function:- Code Resuability Code optimization

Syntax to declare function:- return_type function_name(data_type paramet er...){   //code to be executed   }   Syntax to call function:- variable=function_name(arguments...);  

Call by value in C language:- 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().

Example of call by value:- #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;   Example of call by value:-

Output window :- Before function call x=100 Before adding value inside function num=100 After adding value inside function num=200 After function call x=100

Call by reference in C:- In call by reference, original value is modified because we pass reference (address). Note : Learn Call by reference in details with example via JavaTpoint.

Example of call by Reference:- #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;  

Output window:- Before function call x=100 Before adding value inside function num=100 After adding value inside function num=200 After function call x=200

Recursion in C:- 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:- 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-D Array 2-D Array

Advantage of array:- Code Optimization Easy to traverse data Easy to sort data Random Access

2-D Array in C:- 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];  

Initialization of 2-d array:- 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 5 6

Pointer in c language 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.

Advantage of pointer in c 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 used in pointer Symbol Name Description & (ampersand sign) address of operator determines the address of a variable. * (asterisk sign) indirection operator accesses the value at the address.

Declaration of pointer 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) //

A simple example of C pointer #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();       }      

value of number is 50, address of number is fff4 Output window value of number is 50, address of number is fff4