Learning C Language.

Slides:



Advertisements
Similar presentations
Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Advertisements

C Language.
Programming Languages and Paradigms The C Programming Language.
Chapter 3: Beginning Problem Solving Concepts for the Computer Programming Computer Programming Skills /1436 Department of Computer Science.
Program Design and Development
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Programming C/C++ on Eclipe C Training Trình bày : Ths HungNM.
Guide To UNIX Using Linux Third Edition
C programming Language and Data Structure For DIT Students.
‘C’ LANGUAGE PRESENTATION.  C language was introduced by Dennis Ritchie..  It is a programming language, which can make a interaction between user and.
C Programming Language tutorial Powered by:-
Introduction to C Language
Computer Science 210 Computer Organization Introduction to C.
Introduction to Computer Algorithmics and Programming Ceng 113 Variables and Operators in C.
Basics of “C” Programming
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
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.
Lecture 10: Modular Programming (functions) B Burlingame 13 April 2015.
Loops cause a section of a program to be repeated a certain number of times. The repetition continues while a condition remains true. When a condition.
C LANGUAGE Characteristics of C · Small size
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
BASIC C PROGRAMMING LANGUAGE TUTORIAL infobizzs.com.
Numbers in ‘C’ Two general categories: Integers Floats
Arithmetic Expressions
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017
Computer Science 210 Computer Organization
C Programming Hardik H. Maheta.
C Programming Tutorial – Part I
Programming Languages and Paradigms
C Language VIVA Questions with Answers
Objectives Identify the built-in data types in C++
Introduction to C++.
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
C Short Overview Lembit Jürimägi.
Programming Paradigms
C Basics.
Module 2 Arrays and strings – example programs.
Prepared By: G.UshaRani B.Pranalini A.S.Lalitha
Introduction to C Programming Language
' C ' PROGRAMMING SRM-MCA.
Arrays in C.
INTRODUCTION c is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs.
Welcome In The World Of ‘C’.  TEXT BOOK: Programming in ANSI ‘C By: E Balagurusamy. TMH  Reference Books: 1) The ‘C Programming Language By: Kernighan.
Visit for more Learning Resources
11/10/2018.
Computer Science 210 Computer Organization
Lexical Elements, Operators, and the C Cystem
Arrays, For loop While loop Do while loop
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Starting JavaProgramming
Introduction to Programming
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Character Set Uppercase Alphabets A,
Java - Data Types, Variables, and Arrays
Basics of ‘C’.
Lexical Elements, Operators, and the C Cystem
Govt. Polytechnic,Dhangar
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.
Govt. Polytechnic,Dhangar
Chapter 2 Array and String Visit to more Learning Resources.
C Programming Getting started Variables Basic C operators Conditionals
C programming Language
WEEK-2.
The C Language: Intro.
C – Programming Language
Programming Languages and Paradigms
C Language B. DHIVYA 17PCA140 II MCA.
Course Outcomes of Programming In C (PIC) (17212, C203):
C Programming Mr. KAJAL MAJI ASSISTANT PROFESSOR DEPARTMENT OF PHYSICS
INTRODUCTION TO C.
Presentation transcript:

Learning C Language

Deep C

HISTORY OF PROGRAMMING LANGUAGE Machine Language Assembly Language High Level Language

Language Translators Compiler Interpreter

C Language

INTRODUCTION TO C LANGUAGE What is C ? C is Programming Language C is a General Purpose Programming language C is a Procedure Oriented Language C is a Structured Language C is a Middle Level Language C is a Superset Language of all the Programming Language

HISTORY OF C LANGUAGE ALGOL 60 DROWBACKS/SHORTCOMMINGS (BY AN INTERNATIONAL COMMITTEE, 1960) IT WAS TOO ABSTRACT & TOO GENERAL CPL HARD TO LEARN & DIFFICULT TO IMPLEMENT (BY CAMBRIDGE & LONDON UNIVERSITY, 1963) BCPL TOO LESS POWERFULL & TOO LESS SPECIFIC (MARTIN RICHARDS AT CAMBRIDGEUNIVERSITY, 1967 ) B MACHINE DEPENDENT & TYPELESS (KEN THOMSON AT BELL LABS, 1970) C (DENNIS RITCHE AT BELL LABS, 1972

IMPORTANCE OF C LANGUAGE FLEXIBILITY POWERFULL SMALL SIZE MODULAR DESIGN PORTABILITY HIGH LEVEL STRUCTURED LANGUAGE FEATURES LOW LEVEL FEATURES USE OF POINTERS EASY TO LEARN EASY TO DEBUG EFFICIENCY ( EASY TO EXECUTE ) EASY TO USE RELIABLE

WRITING & EXECUTING A C PROGRAM .EXE FILE CREATING A SOURCE CODE COMPILING THE SOURCE CODE LINKING THE SOURCE CODE RUNNING THE EXECUTABLE CODE .OBJ FILE OBJECT CODE EXECUTABLE CODE WRITTEN C PROGRAM PRE-PROSSED CODE LINKER EDITOR PRE PROCESSOR COMPILER COMPILATION Linking

Fig: Flowchart of execution of c programme YES START WRITTEN C CODE TYPE THE PROGRAM SOURCE PROGRAMME FILE.C COMPILER SOURCE CODE EDIT PROGRAMME NO SYNTAX ERROR OBJECT PROGRAMME FILE.OBJ LIBRARY + OBJECT PROGRAMME LINK THE PROGRAM EXECUTABLE CODE FILE.EXE CORRECT I/O DATA EXECUTE NO LOGICAL ERROR Fig: Flowchart of execution of c programme YES STOP

STRUCTURE OF C PROGRAMME DOCUMENTATION SECTION OPTIONAL 1 LINK SECTION COMPULSORY 2 DEFINATION SECTION 3 OPTIONAL GLOBAL DECLARATION SECTION OPTIONAL 4 MAIN () SECTION COMPULSORY 5 { Declarative part Executable part }

C TOCKENS KEYWORDS IDENTIFIERS CONSTANTS VARIABLES OPERATORS

DATA TYPES EMPTY DATA SET PRIMARY/ DERIVED STRUCTURED USER DEFINED Array Structure Union pointer 1. enum 1. void Int Flot Char double

Fundamental Data Types Description Size ( In Bytes ) Range Int An integer number 2 bytes -32768 to 32767 Float A single precision floating point number 4 bytes -2147483648 to 2147483647 Char A single character 1 byte -128 to 127 Double A double precision floating point number 8 byte 1.7 e-308 to 1.7 e+308 Void Empty data type Valueless

ARITHMETIC OPERATORS 5 + - * / % RELATIONAL OPERATORS 6 < > <= >= == != LOGICAL OPERATORS 3 && || ! ASSIGNMENT OPERATORS 1 = INCREMENT & DECREMENT OPERATORS 2++ -- CONDITIONAL OPERATORS ? : / if else BITWISE OPERATORS 6 & | << >> ~ OTHER OPERATORS 7 , sizeof() typecast() & * [] ()

STATEMENT Null Statement  ; on line Def: Computer can take the decision but taking a decision for computer statement is required. Null Statement  ; on line Expression Statement  assignment/function call Compound Statement { } Selection Statement  condition check if if else Iteration Statement  Iteration while do while for Jump Statement  go to break continue Labeled Statement  xx

SELECTION/DECISION MAKING STATEMNET If If …..else Nested if …. Else If else ladder Switch statement

ITERATIVE / LOOPING STATEMENT While Loop Do….while Loop For Loop

1. While Loop Entry controlled loop / top tested loop Syntax : Initialization; While ( Test_condition) { Body of the while loop; }

2. Do….while Loop Exit controlled loop / bottom tested loop Syntax : Initialization; Do { Body of the do loop; } While (Test_condition);

3. For Loop Most powerful, flexible & commonly used Loop Top tested Syntax : For(initialization; test_condition; incr/decr) { Body of the for loop }

Jumping statement Break statement : whole program terminated Continue statement : that particular stat is terminated Goto statement

Array One dimensional array Two dimensional array / matrix Definition: Array is the collection of similar type of data elements. Types of Array One dimensional array Two dimensional array / matrix Multi dimensional array More than one values can be stored in a variable of a similar type.

Array declaration does following things: The name of the array The type of the array The dimension of the array The size of the array For ex: int a[10]; int a[2] [2]; int a[2] [3] [3];

Handling of C character set Def : A string is an array of characters terminated by a special character Null (‘\0’) Reading & writing string Combining string together - strcat Copying one string to another – strcpy Comparing string for equality – strcmp Calculating length of string – strlen

1.Combining string together /* strcat demo */ Void main() { Char str1[ ] = “Bill”; Char str2[] = “Gates”; Strcat (str1, “ “); Strcat (str1, str2); Printf(“\n%s”, str1); } Otuput : Bill Gates

2. Copying string together : Void main() { Char str1[ ]= “BCA”; Char str2[ ]= “BBA”; Char str3[ ]; Strcpy(str3,str1); Strcat(str3,str2); Printf(%s”,str3); Output : BCABBA

3.Comparing string together: Void main() Char city1[ ]= “Bombay”; Char city2[ ]= “Osmanabad”; Int i,j; i=strcmp(city1,city2); j=strcmp(city2,city2); Printf(“%d”, i); Printf(%d”,j); } B=66 O=79 Output: -13 13

4.Calculating the length of string : Void main() { Int I; Char city[]= “Osmanabad”; i=strlen(city); Printf(“%d”,strlen(city)); } Output: 9

STRUCTURE Def: A structure is a collection of different types of data types grouped together under a single name. Each variable within the structure is called a member. The name given to the structure is called structure tag.

Instance is the structure variable used to initialize the structure Syntax : Struct tag { Member1; Member2; . Membern; }; Struct tag instance; For Ex: Struct student { Char name[20]; Int roll no; Int marks; }; Struct student s; Instance is the structure variable used to initialize the structure

UNION Def: A UNION is a collection of different types of data types grouped together under a single name. Each variable within the union is called a member. The name given to the union is called union tag.

Instance is the structure variable used to initialize the structure Syntax : union tag { Member1; Member2; . Membern; }; union tag instance; For Ex: union student { Char name[20]; Int roll no; Int marks; }; unioin student s; Instance is the structure variable used to initialize the structure

Pointer Pointer is an important part of the c language which provide a powerful flexible way to manipulate the data. Reason for using the pointer: 1. accessing the variable defined outside of the function. 2. more efficient in handling data tables. 3. reduce the length of the program 4. reduce the complexity 5. pointer increase the execution speed. Def: Pointer is the variable which store the address of the next variable.

FUNCTION Def : A function is a self-contained block of statement that perform a specific well defined task and may return the value to the calling program. A function is named- accessed by name A function is independent-perform the task on its own Specific task It will return the value to the calling program.

TYPES OF FUNCTION Library function User defined function

1. Library function 1.<stdio.h> = printf() & scanf() 2.<conio.h> = clrscr() & getch() 3.<math.c> = pow(), exp() & sqrt() 4.<graphic.c> = circle(), setcolor() & bar() LIBRARY FILES FUNCTIONS

2. User Defined Functions For ex : Main() { /* call to func1()*/ Func1(); ---- /* call to func2()*/ Func2(); } Func1() { ----- func3(); } Func3() { ---- } Func2() { ----- }

THANK YOU, VERY MUCH END